cplusplusqt | Unsorted

Telegram-канал cplusplusqt - C++ & Qt

1169

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

Subscribe to a channel

C++ & Qt

Yh I generated it , .py file and imported in the main file application but still didn’t work, I added some debug statements to check the file path but shows it wasn’t found

Читать полностью…

C++ & Qt

anyone help me please?

# test_icon.py

import sys
from PySide6.QtWidgets import QApplication, QLabel, QVBoxLayout, QWidget
from PySide6.QtGui import QPixmap
from qss_style import resources_rc # Import the compiled resources


# <!-- clean/qss_style/resources.qrc -->
# <RCC>
# <qresource prefix="/icons">
# <file>icons/drop_down.png</file>
# <!-- Add more icon files here if needed -->
# </qresource>
# <qresource prefix="/styles">
# <file>style.qss</file>
# </qresource>
# </RCC>

#-- Command---#
# pyside6-rcc resources.qrc -o resources_rc.py


def main():
app = QApplication(sys.argv)

window = QWidget()
layout = QVBoxLayout()

label = QLabel()
pixmap = QPixmap(":/icons/drop_down.png")
if pixmap.isNull():
print("Failed to load icon: :/icons/drop_down.png")
label.setText("Icon Failed to Load")
else:
print("Successfully loaded icon: :/icons/drop_down.png")
label.setPixmap(pixmap.scaled(16, 16)) # Adjust size as needed

layout.addWidget(label)
window.setLayout(layout)
window.show()

sys.exit(app.exec())

if __name__ == "__main__":
main()
icon not working or showing, please download an image online and use it to test for me and fix for me

Читать полностью…

C++ & Qt

anyone help me please?

# test_icon.py

import sys
from PySide6.QtWidgets import QApplication, QLabel, QVBoxLayout, QWidget
from PySide6.QtGui import QPixmap
from qss_style import resources_rc # Import the compiled resources


# <!-- clean/qss_style/resources.qrc -->
# <RCC>
# <qresource prefix="/icons">
# <file>icons/drop_down.png</file>
# <!-- Add more icon files here if needed -->
# </qresource>
# <qresource prefix="/styles">
# <file>style.qss</file>
# </qresource>
# </RCC>

#-- Command---#
# pyside6-rcc resources.qrc -o resources_rc.py


def main():
app = QApplication(sys.argv)

window = QWidget()
layout = QVBoxLayout()

label = QLabel()
pixmap = QPixmap(":/icons/drop_down.png")
if pixmap.isNull():
print("Failed to load icon: :/icons/drop_down.png")
label.setText("Icon Failed to Load")
else:
print("Successfully loaded icon: :/icons/drop_down.png")
label.setPixmap(pixmap.scaled(16, 16)) # Adjust size as needed

layout.addWidget(label)
window.setLayout(layout)
window.show()

sys.exit(app.exec())

if __name__ == "__main__":
main()
icon not working or showing, please download an image online and use it to test for me and fix for me

Читать полностью…

C++ & Qt

Welcome to the group, @IshaqShamraiz! :-)

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. :)

Читать полностью…

C++ & Qt

@unknowRecon [6131908980] warned (1 of 2).
Due to: refrain from unauthorized self promotion

Читать полностью…

C++ & Qt

Maybe this is enough, I didn't find where is the source code of Qt for MCU (while it should be accessible, ask to the devs directly I think, which is concerning).

Читать полностью…

C++ & Qt

/report isn't that an add?

Читать полностью…

C++ & Qt

How to download turbo c++

Читать полностью…

C++ & Qt

Hi
I have been a qml / c++ dev for past 1.5 yrs..and here to make connections and interact/ brainstorm ideas

Читать полностью…

C++ & Qt

I learned through a program that it was written in Python and compiled with C++.

Читать полностью…

C++ & Qt

Hello, is it possible to access the source code of an exe file written in Python and compiled with C++?

Читать полностью…

C++ & Qt

someone fixed for me, thanks bro

Читать полностью…

C++ & Qt

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.

Читать полностью…

C++ & Qt

I need functionality of

nx.algorithms.has_path(g, node_addr1, node_addr2)

Читать полностью…

C++ & Qt

I need functionality of

nx.algorithms.has_path(g, node_addr1, node_addr2)

Читать полностью…

C++ & Qt

Do you get an error? Is the resource file generated?

Читать полностью…

C++ & Qt

anyone help me please?

# test_icon.py

import sys
from PySide6.QtWidgets import QApplication, QLabel, QVBoxLayout, QWidget
from PySide6.QtGui import QPixmap
from qss_style import resources_rc # Import the compiled resources


# <!-- clean/qss_style/resources.qrc -->
# <RCC>
# <qresource prefix="/icons">
# <file>icons/drop_down.png</file>
# <!-- Add more icon files here if needed -->
# </qresource>
# <qresource prefix="/styles">
# <file>style.qss</file>
# </qresource>
# </RCC>

#-- Command---#
# pyside6-rcc resources.qrc -o resources_rc.py


def main():
app = QApplication(sys.argv)

window = QWidget()
layout = QVBoxLayout()

label = QLabel()
pixmap = QPixmap(":/icons/drop_down.png")
if pixmap.isNull():
print("Failed to load icon: :/icons/drop_down.png")
label.setText("Icon Failed to Load")
else:
print("Successfully loaded icon: :/icons/drop_down.png")
label.setPixmap(pixmap.scaled(16, 16)) # Adjust size as needed

layout.addWidget(label)
window.setLayout(layout)
window.show()

sys.exit(app.exec())

if __name__ == "__main__":
main()
icon not working or showing, please download an image online and use it to test for me and fix for me

Читать полностью…

C++ & Qt

anyone help me please?

# test_icon.py

import sys
from PySide6.QtWidgets import QApplication, QLabel, QVBoxLayout, QWidget
from PySide6.QtGui import QPixmap
from qss_style import resources_rc # Import the compiled resources


# <!-- clean/qss_style/resources.qrc -->
# <RCC>
# <qresource prefix="/icons">
# <file>icons/drop_down.png</file>
# <!-- Add more icon files here if needed -->
# </qresource>
# <qresource prefix="/styles">
# <file>style.qss</file>
# </qresource>
# </RCC>

#-- Command---#
# pyside6-rcc resources.qrc -o resources_rc.py


def main():
app = QApplication(sys.argv)

window = QWidget()
layout = QVBoxLayout()

label = QLabel()
pixmap = QPixmap(":/icons/drop_down.png")
if pixmap.isNull():
print("Failed to load icon: :/icons/drop_down.png")
label.setText("Icon Failed to Load")
else:
print("Successfully loaded icon: :/icons/drop_down.png")
label.setPixmap(pixmap.scaled(16, 16)) # Adjust size as needed

layout.addWidget(label)
window.setLayout(layout)
window.show()

sys.exit(app.exec())

if __name__ == "__main__":
main()
icon not working or showing, please download an image online and use it to test for me and fix for me

Читать полностью…

C++ & Qt

Thanks. This helps a lot

Читать полностью…

C++ & Qt

/warn refrain from unauthorized self promotion

Читать полностью…

C++ & Qt

Report sent⁣⁣⁣

Читать полностью…

C++ & Qt

Use Qt IDE for C++ .

Читать полностью…

C++ & Qt

Can anyone here point me to the implementation of ArcItem (qml mcus) in github repo...

Читать полностью…

C++ & Qt

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

Читать полностью…

C++ & Qt

How was it compiled? I think it will be hard to recover the actual source code, but you may be able to get something.

Читать полностью…

C++ & Qt

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. :)

Читать полностью…

C++ & Qt

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())


The value received from the setData function value argument is an int data type while Qt.CheckState Enum is a Literal, to implement a toggle logic you will have to make comparison with integer values
 x: int == y: int
.
You will see that the value arg from setData() -> [Unchecked == 2, Checked == 0]

Читать полностью…

C++ & Qt

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

Читать полностью…

C++ & Qt

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

Читать полностью…

C++ & Qt

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

Читать полностью…
Subscribe to a channel