Skip to content
  • 144k Topics
    720k Posts
    S
    Hi, everyone, I'm working on a Qt6/C++ Qt Widgets application using QMainWindow and QTabWidget. One tab embeds a QWebEngineView (in a tab named "Browser"). Another tab (called "Vocabulary") displays custom CardWidgets. Each of which includes a QToolButton with a QMenu. Issue: When the app starts (the Vocabulary tab is active), everything works fine — the menu shows as expected when the button is clicked. But after I switch to the Browser tab (with QWebEngineView) and then return to Vocabulary, the QToolButton click is detected but the menu no longer appears. There are no crashes or warnings, and the QToolButton is still visible and responsive — just no menu. CardWidget constructor snippet: CardWidget::CardWidget(const QVariantList& data, QWidget *parent) : QWidget(parent), expanded(false), currentRating(0) { this->id = data[0].toInt(); this->word = data[1].toString(); setCursor(Qt::PointingHandCursor); // Cursor on hover setStyleSheet(R"( QWidget { border: 1px solid transparent; border-radius: 8px; padding: 8px; } QWidget:hover { border: 2px solid #3498db; } )"); QVBoxLayout* mainLayout = new QVBoxLayout(this); // Top Layout QHBoxLayout* topLayout = new QHBoxLayout(); titleLabel = new QLabel(data[1].toString()); titleLabel->setStyleSheet("font-weight: bold; font-size: 16px;"); topLayout->addWidget(titleLabel); menuButton = new QToolButton(); menuButton->setText("⋮"); menuButton->setPopupMode(QToolButton::InstantPopup); menuButton->installEventFilter(this); QMenu* menu = new QMenu(); QAction* editAction = menu->addAction("Edit"); QAction* deleteAction = menu->addAction("Delete"); menuButton->setMenu(menu); menuButton->setFocus(); topLayout->addWidget(menuButton); connect(editAction, &QAction::triggered, this, [this](){ emit CardWidget::editRequested(this->id); }); connect(deleteAction, &QAction::triggered, this, [this](){ emit CardWidget::deleteRequested(this->id); }); mainLayout->addLayout(topLayout); // Expandable area expandableArea = new QWidget(); QVBoxLayout* expandLayout = new QVBoxLayout(expandableArea); QStringList labels = { "Part of Speech", "Meaning", "Example", "Synonyms", "Antonyms", "Notes" }; for (int i = 2; i < 8 && i < data.size(); ++i) { QLabel* label = new QLabel(QString("<b>%1:</b> %2").arg(labels[i - 2], data[i].toString())); label->setWordWrap(true); expandLayout->addWidget(label); } expandableArea->setVisible(false); mainLayout->addWidget(expandableArea); // Star Rating int rating = data[8].toInt(); QHBoxLayout* starsLayout = new QHBoxLayout(); for (int i = 0; i < 5; ++i) { QPushButton* star = new QPushButton("☆"); star->setFlat(true); star->setStyleSheet("font-size: 20px; color: gold;"); starButtons.append(star); starsLayout->addWidget(star); setRating(rating); connect(star, &QPushButton::clicked, this, [this, i]() { setRating(i+1); }); } mainLayout->addLayout(starsLayout); } In MainWindow DictionaryApp::DictionaryApp(QWidget *parent) : QMainWindow(parent) , ui(new Ui::DictionaryApp) { ui->setupUi(this); ui->statusBar->hide(); browser = new QWebEngineView(); QVBoxLayout *layout = qobject_cast<QVBoxLayout *>(ui->browser_container->layout()); if(layout) { layout->insertWidget(1, browser); } pool = new QThreadPool(); initDB(); full_refresh_vocabTab(); } full_refresh_vocabTab function: void DictionaryApp::full_refresh_vocabTab() { QList<QVariantList> records = loadFromDB(); QVBoxLayout* layout = qobject_cast<QVBoxLayout*>(ui->vocabListContainer->layout()); if (!layout) { qDebug() << "Error: No layout set for vocabListContainer"; return; } // Clear previous cards if needed QLayoutItem* item; while ((item = layout->takeAt(0)) != nullptr) { if (item->widget()) delete item->widget(); delete item; } // Add new cards for (const QVariantList& row : records) { CardWidget* card = new CardWidget(row); cards.append(card); layout->addWidget(card); connect(card, &CardWidget::editRequested, this, &DictionaryApp::onEditRequested); connect(card, &CardWidget::deleteRequested, this, &DictionaryApp::onDeleteRequested); connect(card, &CardWidget::ratingChanged, this, &DictionaryApp::full_refresh_vocabTab); } } What I've Tried eventFilter() confirms that the button is receiving mouse clicks even after the tab switch. The menu works only until I visit the QWebEngineView tab. Returning to the Vocabulary tab causes the menu to stop opening. There are no errors in the debug output. Tried removing/re-adding the widget — no change. Question: What might cause a QToolButton's QMenu to stop appearing after switching to a tab containing a QWebEngineView and then returning? Versions: Qt6.9 Qt Creator 13.0.0 OS: Fedora
  • Jobs, project showcases, announcements - anything that isn't directly development
    4k 23k
    4k Topics
    23k Posts
    PedroP
    Hey Qt! We have successfully updated our Qt Forum, which now runs on NodeBB v4.3. You can check the link above for all the technical details. Additionally, some extra stuff: New Features: Profile View Now you get a profilecard snippet by hovering over a user's name/picture. Polls You can now create polls to ask questions! When creating a topic, you have on the menu the "Create a poll" button, where you can click and fill out the necessary info for your poll. Some considerations about Polls: You can only create a poll when creating a topic You cannot create polls when replying to a topic You cannot edit a poll; make sure it's all correct before creating it Polls inside locked topics are still open for answers Welcome Message Those who login for the first time will get an instant notification with a brief Welcome message with a clickable link to our Forum Guidelines & Code of Conduct. Known Issues: None. If you find any, please let us know! Special thanks to our IT Team for another smooth Forum Update! If you notice any bugs or particular issues, please contact us or leave your report below so we can evaluate and address it. Enjoy it and happy developing!
  • Everything related to designing and design tools

    126 377
    126 Topics
    377 Posts
    P
    AFAIK this should work but it will not be visible in Assets tab but rather in Components: [image: 4bac87b2-d7be-4ed2-96d3-7e5911dc4694.png] Moreover, I just tried that with your configuration and the file generated was not empty. Honestly, I do not know what might have happened, your best bet is creating a ticket and attaching the .fig and .qtbridge files.
  • Everything related to the QA Tools

    75 210
    75 Topics
    210 Posts
    H
    I'm getting the following error when I run "Squish for Qt 9.0.0" squishrunner.exe : Found invalid metadata in lib ../dlls/qt/imageformats/qgif.dll: Invalid metadata version Using qtplugininfo I get the following metadata for the file: qtplugininfo .\imageformats\qgif.dll IID "org.qt-project.Qt.QImageIOHandlerFactoryInterface" Qt 6.8.0 (release) User Data: { "Keys": [ "gif" ], "MimeTypes": [ "image/gif" ] } Finally, the Squish installation buildinfo.txt file: Package Name: squish-9.0.0-qt68x-win64-msvc143 Internal Name: /home/autotest/public_html/binpackages/2025/02/28-1700/bin_package/9.0.0/qt/Teufelsbek-Qt6.8.0binary-TkNone-iOSNone-MSVC143x64-fcaab59 Git Branch: 9.0.0 Git Revision: 239e98e6029aa13633774415f0c38f3d47257f2d Python Version: default Patched: False Debug Build: False Debug Symbols: False Pure Qt4 Build: False Include IDE: True Python 2: S:/binPackage/Python/x64/2.7.10binary_ssl Python 3: S:/binPackage/Python/x64/3.10.6binary Tcl: S:/binPackage/tcl/x64/8.6.4 Perl: S:/binPackage/Perl/x64/5.34.0 Ruby: S:/binPackage/Ruby/x64/2.5.3 My build environment is Qt 6.8.2 and MSVC 2022 for a 64-bit target.
  • Everything related to learning Qt.

    378 2k
    378 Topics
    2k Posts
    D
    I already wrote to this e-mail by using the built-in function from youtestme - no answer yet. The result from the test is already there I am just waiting for the proctoring report. [image: 64449ca2-2b0f-4143-886d-e822cda62e62.png]
  • 2k Topics
    13k Posts
    W
    Solved by myself. I found "-utf-8" in two .conf files..
  • 4k Topics
    18k Posts
    V
    项目中使用了QTimer定时器,连接槽函数如下void QMammo::on_timerDate_timeout() { static E_DateFormat dateFormat = SysConfig::getInstance()->GeneralSettings.DateFormat; static E_TimeFormat timeFormat = SysConfig::getInstance()->GeneralSettings.TimeFormat; QString strDate, strTime; Utility::utcDateTime2QString(QDateTime::currentDateTimeUtc(), dateFormat, timeFormat, &strDate, &strTime); ui.labelDateInfo->setText(strDate); ui.labelTimeInfo->setText(strTime); } 但发现程序放在那长时间运行没有去响应任何行为的情况下,过了8个小时左右UI刷新不了,后点击界面中任意按钮恢复更新,这是为什么?
  • This is where all the posts related to the Qt web services go. Including severe sillyness.
    1k 10k
    1k Topics
    10k Posts
    Paul ColbyP
    Hi @RokeJulianLockhart, just some additional thoughts to consider... Kubuntu is an official "flavor" of Ubuntu. That is, its supported by Ubunutu, and has the same LTS and non-LTS releases Ubuntu has. KDE Neon is based-on an LTS Ubuntu, but is not supported by Ubuntu. It contains more recent KDE components, and is maintained (not sure about supported) by KDE devs. So there's definitely pro's and con's to both. But I'm sure both are good either way. I ask about Kubuntu explicitly because it's Qt-based, being the KDE Plasma variant, so I prefer it for verifying Qt bugs. While KDE is Qt-based, it actually uses Qt-derived libs, rather than Qt per se. So while it really doesn't matter, if you really like to use Qt on Ubuntu (as I do), then I can recommend Lubuntu, which is also an official Ubuntu flavour (supported by Ubuntu), but using the LXQt desktop by default instead. LXQt is a lightweight Qt-based desktop environment, so much more Qt-pure than KDE is (though again, it really doesn't matter). It's certainly not as feature rich as KDE, but then its without KDE's bloat too. LXQt suits my needs perfectly (by largely staying out of my way), but of course might not be right for you. Worth knowing about anyway. Cheers.