Link: @CplusplusQt Embedded: @EMBCpp • Allowed Topics: C++ and everything related to Qt • Use only English • No Private Message without asking user's permission • No NSFW • No Spam • No unauthorized Bots • No Offtopic • No Self Promotions
Can anyone here point me to the implementation of ArcItem (qml mcus) in github repo...
Читать полностью…Then you'll need to do some reverse engineering, and the data will depend on how it was compiled. I do not think you will ever be able to recover the Python version at all
Читать полностью…How was it compiled? I think it will be hard to recover the actual source code, but you may be able to get something.
Читать полностью…Welcome to the group, -! :-)
Wanna share your story of how you started with Qt, QML or C++? Maybe some nice feature that made you stick with it.
Rules are set on the description of the group. :)
import sys
import typing
from PySide6.QtWidgets import QApplication, QListView
from PySide6.QtCore import QAbstractListModel, QModelIndex, Qt
class ChoiceModel(QAbstractListModel):
def __init__(self, data: typing.List[dict], parent=None) -> None:
super().__init__(parent=parent)
self._data = data
def rowCount(self, parent = QModelIndex) -> int:
return len(self._data)
def data(self, index: QModelIndex, role: int = Qt.ItemDataRole.DisplayRole) -> typing.Any:
ret = None
if not self._data:
ret = None
if not index.isValid():
ret = None
if role == Qt.ItemDataRole.DisplayRole:
ret = self._data[index.row()]["name"]
if role == Qt.ItemDataRole.CheckStateRole:
ret = Qt.CheckState.Checked if self._data[index.row()]["checked"] else Qt.CheckState.Unchecked
return ret
def setData(self, index: QModelIndex, value: typing.Any, role = Qt.ItemDataRole.CheckStateRole) -> bool:
if not index.isValid():
return False
if role == Qt.ItemDataRole.CheckStateRole:
self._data[index.row()]["checked"] = False if value == 0 else True
self.dataChanged.emit(index, index, [Qt.ItemDataRole.CheckStateRole])
return True
def flags(self, index: QModelIndex) -> Qt.ItemFlag:
if not index.isValid():
return Qt.ItemFlag.NoItemFlags
return Qt.ItemFlag.ItemIsEnabled | Qt.ItemFlag.ItemIsSelectable | Qt.ItemFlag.ItemIsUserCheckable
if __name__ == "__main__":
app = QApplication(sys.argv)
view = QListView()
view.setWindowTitle('Choice Model List View')
model = ChoiceModel([{"name": "Item 1", "checked": True}, {"name": "Item 2", "checked": False}])
view.setModel(model)
view.setMinimumSize(400, 600)
view.show()
sys.exit(app.exec())
x: int == y: int.
what I've tried so far. get shortest path as array
struct VertexBB {Читать полностью…
uint64_t id;
std::vector<Instr_with_content> instrs;
};
struct Edge {
uint64_t from_id;
uint64_t to_id;
};
//using BGraph = boost::directed_graph<VertexBB, Edge>;
using BGraph = boost::adjacency_list<
boost::vecS,
boost::vecS,
boost::directedS,
VertexBB,
Edge>;
typedef boost::graph_traits<BGraph>::vertex_descriptor VertexDesc;
typedef boost::graph_traits<BGraph>::edge_descriptor EdgeDesc;
std::vector<VertexDesc> getPath(
const BGraph& graph,
const std::vector<VertexDesc>& pMap,
const VertexDesc source,
const VertexDesc destination
) {
std::vector<VertexDesc> path;
//VertexDesc current = destination;
//while (current != source)
//{
// path.push_back(current);
// current = pMap[current];
//}
//path.push_back(source);
//return path;
VertexDesc current = destination;
do {
auto const pred = pMap.at(current);
std::cout << "extract path: " << std::hex << graph[current].id << " <- "
<< std::hex << graph[pred].id << "\n";
if (current == pred)
break;
current = pred;
path.push_back(current);
} while (current != source);
std::reverse(path.begin(), path.end());
return path;
}
std::vector<VertexDesc> djikstra(
const BGraph& graph,
const VertexDesc source,
const VertexDesc destination
) {
const int numVertices = boost::num_vertices(graph);
std::vector<int> distances(numVertices);
std::vector<VertexDesc> pMap(numVertices);
auto distanceMap =
boost::predecessor_map(
boost::make_iterator_property_map(
pMap.begin(),
boost::get(boost::vertex_index, graph)))
.distance_map(
boost::make_iterator_property_map(
distances.begin(),
boost::get(boost::vertex_index, graph)))
.weight_map(boost::make_constant_property<EdgeDesc>(1.0));
boost::dijkstra_shortest_paths(graph, source, distanceMap);
return getPath(graph, pMap, source, destination);
}
.....
calling
std::vector<VertexDesc> path = djikstra(BGWTA.graph, vd_node, vd_node1);
path.size is ALWAYS 0
what I've tried so far. get shortest path as array
struct VertexBB {Читать полностью…
uint64_t id;
std::vector<Instr_with_content> instrs;
};
struct Edge {
uint64_t from_id;
uint64_t to_id;
};
//using BGraph = boost::directed_graph<VertexBB, Edge>;
using BGraph = boost::adjacency_list<
boost::vecS,
boost::vecS,
boost::directedS,
VertexBB,
Edge>;
typedef boost::graph_traits<BGraph>::vertex_descriptor VertexDesc;
typedef boost::graph_traits<BGraph>::edge_descriptor EdgeDesc;
std::vector<VertexDesc> getPath(
const BGraph& graph,
const std::vector<VertexDesc>& pMap,
const VertexDesc source,
const VertexDesc destination
) {
std::vector<VertexDesc> path;
//VertexDesc current = destination;
//while (current != source)
//{
// path.push_back(current);
// current = pMap[current];
//}
//path.push_back(source);
//return path;
VertexDesc current = destination;
do {
auto const pred = pMap.at(current);
std::cout << "extract path: " << std::hex << graph[current].id << " <- "
<< std::hex << graph[pred].id << "\n";
if (current == pred)
break;
current = pred;
path.push_back(current);
} while (current != source);
std::reverse(path.begin(), path.end());
return path;
}
std::vector<VertexDesc> djikstra(
const BGraph& graph,
const VertexDesc source,
const VertexDesc destination
) {
const int numVertices = boost::num_vertices(graph);
std::vector<int> distances(numVertices);
std::vector<VertexDesc> pMap(numVertices);
auto distanceMap =
boost::predecessor_map(
boost::make_iterator_property_map(
pMap.begin(),
boost::get(boost::vertex_index, graph)))
.distance_map(
boost::make_iterator_property_map(
distances.begin(),
boost::get(boost::vertex_index, graph)))
.weight_map(boost::make_constant_property<EdgeDesc>(1.0));
boost::dijkstra_shortest_paths(graph, source, distanceMap);
return getPath(graph, pMap, source, destination);
}
.....
calling
std::vector<VertexDesc> path = djikstra(BGWTA.graph, vd_node, vd_node1);
path.size is ALWAYS 0
what I've tried so far. get shortest path as array
struct VertexBB {Читать полностью…
uint64_t id;
std::vector<Instr_with_content> instrs;
};
struct Edge {
uint64_t from_id;
uint64_t to_id;
};
//using BGraph = boost::directed_graph<VertexBB, Edge>;
using BGraph = boost::adjacency_list<
boost::vecS,
boost::vecS,
boost::directedS,
VertexBB,
Edge>;
typedef boost::graph_traits<BGraph>::vertex_descriptor VertexDesc;
typedef boost::graph_traits<BGraph>::edge_descriptor EdgeDesc;
std::vector<VertexDesc> getPath(
const BGraph& graph,
const std::vector<VertexDesc>& pMap,
const VertexDesc source,
const VertexDesc destination
) {
std::vector<VertexDesc> path;
//VertexDesc current = destination;
//while (current != source)
//{
// path.push_back(current);
// current = pMap[current];
//}
//path.push_back(source);
//return path;
VertexDesc current = destination;
do {
auto const pred = pMap.at(current);
std::cout << "extract path: " << std::hex << graph[current].id << " <- "
<< std::hex << graph[pred].id << "\n";
if (current == pred)
break;
current = pred;
path.push_back(current);
} while (current != source);
std::reverse(path.begin(), path.end());
return path;
}
std::vector<VertexDesc> djikstra(
const BGraph& graph,
const VertexDesc source,
const VertexDesc destination
) {
const int numVertices = boost::num_vertices(graph);
std::vector<int> distances(numVertices);
std::vector<VertexDesc> pMap(numVertices);
auto distanceMap =
boost::predecessor_map(
boost::make_iterator_property_map(
pMap.begin(),
boost::get(boost::vertex_index, graph)))
.distance_map(
boost::make_iterator_property_map(
distances.begin(),
boost::get(boost::vertex_index, graph)))
.weight_map(boost::make_constant_property<EdgeDesc>(1.0));
boost::dijkstra_shortest_paths(graph, source, distanceMap);
return getPath(graph, pMap, source, destination);
}
.....
calling
std::vector<VertexDesc> path = djikstra(BGWTA.graph, vd_node, vd_node1);
path.size is ALWAYS 0
I found that for some reason I didnt need to include it to the .h, but had to include to the .cpp
Читать полностью…It references to the line which is just fine (the code was already written before and I didnt touch it)
Читать полностью…Bunch of errors (unfortunatelly in my native language so I doubt its usefull for u to understand :) )
Читать полностью…Do you mean literally ”include *.h” (which isn’t allowed) or that all h files breaks your code?
Читать полностью…Hi
I have been a qml / c++ dev for past 1.5 yrs..and here to make connections and interact/ brainstorm ideas
I learned through a program that it was written in Python and compiled with C++.
Читать полностью…Hello, is it possible to access the source code of an exe file written in Python and compiled with C++?
Читать полностью…I guess you need to call setRowCount (and setColumnCount) in the model constructor. If this is not helping, give a more precise description of what is not working.
Читать полностью…I need functionality of
nx.algorithms.has_path(g, node_addr1, node_addr2)Читать полностью…
I need functionality of
nx.algorithms.has_path(g, node_addr1, node_addr2)Читать полностью…
I need functionality of
nx.algorithms.has_path(g, node_addr1, node_addr2)Читать полностью…
Another question what is the minimal condition for covariance? isnt it enough that class B inherits class A?
Читать полностью…Perhaps you have to add some include directories? Perhaps the header file you included tries to include other files?
Читать полностью…A good strategy is to focus on the first error. Solving that often makes the rest go away too.
Читать полностью…Last few hours when I was getting error it was 100% clear what happened, now its just a pile of a mess
Читать полностью…I meant a single .h file that I include into another .h causes the build error
Читать полностью…Hellow everyone, can smbd give me a clue why when I include *.h im getting many build errors? Or the question is a bit silly cuz highly depends on the implementation?
Читать полностью…