Skip to content

General and Desktop

This is where all the desktop OS and general Qt questions belong.
83.6k Topics 457.7k Posts
  • trouble with height-for-width

    Solved
    5
    0 Votes
    5 Posts
    396 Views
    D
    Hi, just to close this: I compiled a Qt with debug info and debugged the layout process. Then I thought, I should extend QLayout::totalSizeHint() - but that function is not virtual. So patching Qt would become expensive :( So I thought, may be QScrollArea has a property for preferred extend direction - which is not the case. But on that research I discovered QScrollArea::setWidgetResizable() ... Oh happy day! That did the trick :) I have nothing to extend or patch, just use this property. What a revelation :D Finally my code looks something like this: Window::Window() : client(new QWidget(this)) { FlowLayout* fl = new FlowLayout; QScrollArea* sa = new QScrollArea; setLayout(new QVBoxLayout); layout()->setMargin(0); client->setLayout(fl); fl->setMargin(0); fl->addWidget(...); fl->addWidget(...); ... sa->setWidget(client); sa->setWidgetResizable(true); layout()->addWidget(sa); } ... and the result looks like: [image: 90fd78c8-892a-4271-8e1d-77643207d376.png] Yeah!
  • QFontDialog doesn't return (sometimes) QFont with correct styleName

    Unsolved
    1
    0 Votes
    1 Posts
    156 Views
    No one has replied
  • How my software can catch/avoid "No carrier" response from QNetwork?

    Solved
    3
    1 Votes
    3 Posts
    1k Views
    V
    Qt 5.15.2 In my case it was network config manager that generated those "No carrier" messages. There's a plugin called qconnmanengine (qtbase/src/plugins/bearer/connman) which in case of wifi bearer periodically scans for wifi. You can simply reproduce this issue just by disable wifi technology (connmanctl disable wifi). void QConnmanTechnologyInterface::scanReply(QDBusPendingCallWatcher *call) { QDBusPendingReply<> props_reply = *call; if (props_reply.isError()) { qDebug() << props_reply.error().message(); } Q_EMIT scanFinished(props_reply.isError()); call->deleteLater(); }
  • How to transffer QImage or QPixmap from one window to another using signals and slots

    Solved
    29
    0 Votes
    29 Posts
    3k Views
    JonBJ
    @swansorter Additionally to @jsulm, you originally had it with your connect(test_label,&my_qlabel::sendImage,this,&MainWindow::onGetImage); You then changed over to SIGNAL/SLOT, for no discernible reason, which may be a clue as to why it went wrong....
  • QT Terminate Browser Process

    Unsolved
    8
    0 Votes
    8 Posts
    1k Views
    JonBJ
    @Dusk-Le You are already spawning the Chrome.exe as a child of your Qt app. If QProcess::kill() does not work you have a problem. Quite possibly because like I suggested the original QProcess you spawn is not kept as the process for the resulting opened window, due to Chrome internals. Start by Googling for, say, kill one chrome process or kill one chrome window, to see how difficult/easy this is. Then if you don't kind a better way, start with the following: Keep your process.start(). You might want to add qDebug() << process.processId(); after it, for use below. Comment out msleep/close/kill(). Let the Chrome run up its window/page/tab. Go into Windows Task Manager. Look through all the (scary number of!) running Chrome processes. (Hint: You may want to View > Select Columns... > find and check the Command Line column.) By experimenting with End Process them, find which one (or ones?) you need to terminate to achieve the right one for your window. Then use Windows EnumProcesses etc. to determine how you can find that desired process(es), and Windows calls to kill it.
  • This topic is deleted!

    Solved
    11
    0 Votes
    11 Posts
    21 Views
  • Transparent QMainWindow for Raspberry Pi

    Solved
    2
    0 Votes
    2 Posts
    727 Views
    R
    It took a while to figure out, but it's finally working. For anyone else with this issue: Use the raspi-config command, go to advanced settings and enable Compositor. Run the xcompmgr command and then try the program again. Transparency now works!
  • Qt5 and Qt6 Bluetooth crashes on segmentation fault.

    Solved
    5
    0 Votes
    5 Posts
    563 Views
    Z
    The similar problem: https://forum.qt.io/topic/119766/unknown-exception-is-not-beeing-caught-in-trycatch-block-bluetooth-low-energy-servicedetailsdiscovery
  • Qt Multimedia not working

    Unsolved
    14
    0 Votes
    14 Posts
    1k Views
    jsulmJ
    @Padawan said in Qt Multimedia not working: I should also deselect it from qt 6.1.0 ? If you don't need it then yes
  • For QTableWidget, what's the difference of cellChanged and itemChanged?

    Solved
    4
    0 Votes
    4 Posts
    2k Views
    SGaistS
    Hi, cellChanged is for all QAbstractItemView classes, itemChanged is specific to the convenience views (QListWidget, QTableWidget, QTreeWidget) where you use the corresponding item classes to interact with the model.
  • Is it possible to fill color inside a bounding rectangle?

    Unsolved
    2
    0 Votes
    2 Posts
    182 Views
    jsulmJ
    @Swati777999 There are various https://doc.qt.io/qt-5/qpainter.html#fillRect methods - aren't those what you need?
  • Why mouserelease event not working on qlable

    Solved
    9
    0 Votes
    9 Posts
    1k Views
    S
    @Pl45m4 Ha yes i was using ui->label->installEventFilter(this); in the main window .Now disabled it and mouse release event is working
  • How do you save and restore the state of QTreeView?

    Solved
    3
    0 Votes
    3 Posts
    2k Views
    D
    @JonB, look at that: void ObjectsView::makeTree() { QStandardItemModel *model; QMap<QString, QStringList*> expanded; if(tree->model()){ for (int row = 0; row < tree->model()->rowCount(); row++) { auto index = tree->model()->index(row, 0); if(!tree->isExpanded(index)) continue; auto node = tree->model()->data(index).toString(); auto trimmed = node.left(node.indexOf(' ')); auto list = new QStringList; expanded.insert(trimmed, list); for (int child = 0; child < tree->model()->rowCount(index); child++) { auto childIndex = tree->model()->index(child, 0, index); if(!tree->isExpanded(childIndex)) continue; node = tree->model()->data(childIndex).toString(); trimmed = node.left(node.indexOf(' ')); list->append(trimmed); } } tree->model()->removeRows(0, tree->model()->rowCount()); model = qobject_cast<QStandardItemModel*>(tree->model()); } .... // rest of the code .... for (int row = 0; row < tree->model()->rowCount(); row++) { auto index = tree->model()->index(row, 0); auto node = tree->model()->data(index).toString(); auto trimmed = node.left(node.indexOf(' ')); if(!expanded.keys().contains(trimmed)) continue; tree->setExpanded(index, true); if(expanded.value(trimmed)->size()){ auto list = expanded.value(trimmed); for (int child = 0; child < tree->model()->rowCount(index); child++) { auto childIndex = tree->model()->index(child, 0, index); node = tree->model()->data(childIndex).toString(); trimmed = node.left(node.indexOf(' ')); if(list->contains(trimmed)) tree->setExpanded(childIndex, true); } } } qDeleteAll(expanded.values()); } and somehow it works: [image: f615ceb4-cfe8-48d3-ab1f-89056b3d1daf.gif] Any suggestion for improvement?
  • Can't adjust font size of QGraphicsTextItem in QGraphicsRectItem

    Solved
    10
    0 Votes
    10 Posts
    1k Views
    JoeCFDJ
    @leinad override paint and set font to painter. It will work.
  • In QTreeView, it crashes when delete the last child

    Solved
    10
    0 Votes
    10 Posts
    1k Views
    Christian EhrlicherC
    You should check your model with the model tester: https://wiki.qt.io/Model_Test
  • Get dimensions of QMovie and setScaledSize respecting aspect ratio

    Solved
    4
    0 Votes
    4 Posts
    2k Views
    SGaistS
    Glad you found a solution and thanks for sharing ! Please mark the thread as solved using the "Topic Tools" button or the three dotted menu beside the answer you deem correct so that other forum users may know a solution has been found :-)
  • Widgets style is not the same as my system's style

    Unsolved
    10
    0 Votes
    10 Posts
    1k Views
    SGaistS
    Even if you use a different style explicitly ?
  • Graphing in PyQT takes over whole page rather than be a standalone portion of the GUI

    Unsolved
    3
    0 Votes
    3 Posts
    258 Views
    SGaistS
    Hi and welcome to devnet, You do no integrate it at all in any other UI component hence it's shown standalone.
  • QTableView: openPersistentEditor doesn't resize

    Unsolved
    5
    1 Votes
    5 Posts
    551 Views
    B
    I'm using the latest PySide2 package available through pip: https://pypi.org/project/PySide2 which is currently PySide2 5.15.2.
  • Why does the app crashes on delete QSqlQuery*

    Solved
    13
    0 Votes
    13 Posts
    1k Views
    D
    @JonB, later after a break, I'll try with a global QSqlQuery* again and will try to use that in other view, where I've used QSqlQueryModel testModel (in previous post), to execute multiple statements AND instead of db.isOpen(), I'll use my global isConnected to see whether it crashes with that or not.