Skip to content

General and Desktop

This is where all the desktop OS and general Qt questions belong.
83.6k Topics 457.6k Posts
  • Context menu on QTreeView item?

    Solved
    5
    0 Votes
    5 Posts
    885 Views
    R
    Thanks, folks. That worked fine.
  • This topic is deleted!

    Unsolved
    2
    0 Votes
    2 Posts
    44 Views
  • fatal error: QStringRef: No such file or directory

    Unsolved
    5
    1 Votes
    5 Posts
    1k Views
    V
    What I did is I installed the Qt5 as I wasn't able to get away with the error /home/devansh/repo/src/libs/languageserverprotocol/jsonkeys.h:6:10: fatal error: QLatin1StringView: No such file or directory 6 | #include <QLatin1StringView> | ^~~~~~~~~~~~~~~~~~~ compilation terminated. [76/2753] Building CXX object src/libs/extensionsystem/CMakeFiles/ExtensionSystem.dir/pluginmanager.cpp.o ninja: build stopped: subcommand failed.
  • Building Qt Creator from source

    Unsolved
    17
    0 Votes
    17 Posts
    4k Views
    J
    j@j-BOHB-WAX9:/$ find / -type f -name qtcreator 2>/dev/null /home/j/Downloads/qtcreator_build/bin/qtcreator
  • QGraphicsScene mousePressEvent event passing problem

    Unsolved
    4
    0 Votes
    4 Posts
    323 Views
    Pl45m4P
    @alvazz said in QGraphicsScene mousePressEvent event passing problem: void AItem::mousePressEvent(QGraphicsSceneMouseEvent *event) { if (event->button() == Qt::LeftButton) { qDebug() << "A Item Pressed!"; } QGraphicsScene::mousePressEvent(event); } Is this your actual code? Used my own test case... You cant call the protected QGraphicsScene::mousePressEvent from a QGraphicsItem. It should be QGraphicsItem::mousePressEvent Besides that, I still cant reproduce... If I click item A, I get "A Item Pressed!" and B, when B is clicked, never both. Show your full code please or if possible make a short GIF/video that illustrates what you are doing [image: a8abd771-fbae-4bdf-8638-f800b65bd22b.gif]
  • Qt6 how to load qml sources at runtime

    Unsolved
    5
    0 Votes
    5 Posts
    658 Views
    D
    @Axel-Spoerl , fyi I got a reply in my bug report that got this working for me. The details are in the ticket, but the magic step is to manually remove the 'prefer' line from MyModule/qmldir in the build directory.
  • Dont know how to build QuaZip. Please help.

    Solved
    9
    0 Votes
    9 Posts
    1k Views
    veryqtpersonV
    In short, you would just add the following right after project() in your CMakeLists.txt: set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED YES) Recent versions of MinGW should be C++17-compliant, so you can probably continue using that, although on Windows I'd recommend using MSVC or maybe Clang. On GNU/Linux the most common choice would be GCC or yet again Clang.
  • Mixing OpenGLFunctions and QPainter in QOpenGLWidget

    Solved
    6
    0 Votes
    6 Posts
    2k Views
    S
    @OkTerrific said in Mixing OpenGLFunctions and QPainter in QOpenGLWidget: Is there an alternative to QOpenGLWidget that you would recommend for rendering with OpenGL in Qt? Well.. theres the QGLWidget and QGLWindow both now deprecated. Then there's the QOpenGLWidget and QOpenGLWindow. I Suppose it comes down to whether you need to compose the OpenGL rendered content with other widgets in the UI. I haven't tried the QOpenGLWindow myself but the QOpenGLWidget has absolutely terrible performance. So what I've ended up using myself is just a QWindow since it implements a QSurface. Then I create the context myself and makeCurrent with the QWindow. Finally I place the QWindow inside a widget with QWidget::createWindowContainer. In my tests this is an order of magnitude better in rendering perf vs. QOpenGLWidget but the caveat is that the Qt compositing is a bit broken so things such as Qt context menus won't work. Neither can you place any other widgets inside the QWindow. Long story short, I can't tell you to use any specific way, there are just too many issues here and it all depends what you want to do. VSYNC is also another related issue and a total PITA.
  • QTConcurent and lambda in QT6

    Solved
    23
    0 Votes
    23 Posts
    2k Views
    Christian EhrlicherC
    @JulsPower said in QTConcurent and lambda in QT6: then I cannot see a usage for future then function The documentation has a nice common use case for it.
  • How to keep track of real time ?

    Unsolved qprocess
    1
    0 Votes
    1 Posts
    289 Views
    No one has replied
  • This topic is deleted!

    Unsolved
    6
    0 Votes
    6 Posts
    38 Views
  • How to prevent Qt child windows from inheriting the style of the parent window?

    Unsolved
    3
    0 Votes
    3 Posts
    366 Views
    IPlayGenji6I
    Add the property parentName to all your QPushButton elements in parentWidget, and set the value to "parentWidget" for each of them. QObjectList buttons = ParentWidget->findChildren<QPushButton*>(); for (QPushButton* button : buttons) { button->setProperty("parentName", "parentWidget"); } in qss: QPushButton[parentName = "parentWidget"] { background: #123456; } [image: 39bfa2b3-660b-414a-acae-28f849731bcd.png]
  • 0 Votes
    13 Posts
    2k Views
    8Observer88
    @Chris-Kawa please, help me with building for Android
  • mac: QTabWidget with large icons: how?

    Solved
    10
    0 Votes
    10 Posts
    2k Views
    D
    @Ans1 i do not know if this helps, but here's my init code: void QtDlgTabs::Panel_Setup() { CDialog* dlgP(GetDialog<CDialog>()); QListWidget *listP(dlgP->QtGetItem<QListWidget>(Dlg_Tabs_ICON_BAR)); Rect iconR = { 0, 0, 64, 64 }; CPixels pix(iconR); ScCGContext context(pix); Qt::ItemFlags flags(Qt::ItemIsSelectable | Qt::ItemIsEnabled); float scaleF(devicePixelRatio()); // doesn't work pix.setDevicePixelRatio(scaleF); static int s_awidthI = 61; static int s_heightI = 50; int s_widthI = 150; bool is_prefsB(dlgP->GetPanelSet() == PrefPanelSet_PREFS); if (is_prefsB) { s_widthI = 70; } int widthI = s_widthI; if (is_prefsB) { if (dlgP->GetAllControlsVisible()) { widthI = s_awidthI; } } listP->setGridSize(QSize(widthI, s_heightI)); PrefPanelSet panelSet(dlgP->GetPanelSet()); SInt16Vec& panelVec(GetPanelVec(panelSet)); for (SInt16 indexS: panelVec) { PanelRec& curPanel(*GetIndPanelRec(panelSet, indexS)); QListWidgetItem *listItemP(new QListWidgetItem()); SuperString nameStr(GetLocalizedPrefPaneName(panelSet, curPanel.prefPanelS)); SDB_SourceType iconType(static_cast<SDB_SourceType>(curPanel.sourceType)); QFont itemFont(listItemP->font()); pix.clear(); gApp->Draw_icns(&context, iconType, iconR, kTransformNone); itemFont.setPointSize(itemFont.pointSize() - 1); listItemP->setFont(itemFont); listItemP->setText(nameStr); listItemP->setIcon(pix); listItemP->setFlags(flags); listP->addItem(listItemP); } }
  • 0 Votes
    10 Posts
    2k Views
    C
    @Pl45m4 said in QTreeView child of QMainWindow not resizing with main window: Remove the current layout and the ElementView. Drag a new ElementView straight on the centralWidget and then rightclick and "lay out". I was doing this, but I misinterpreted what the rightclick applied to. I thought it applied to the new Element View I dragged onto the centralWidget, and its "Lay out" menu had most everything disabled. When I tried rightclicking on the centralWidget outside of the ElementView, its menu had the selections all available. All is working now and I have removed my resizeEvent(). @Pl45m4 and @JonB - All comments are much appreciated!
  • Unable to build from source in debug config

    Unsolved
    1
    0 Votes
    1 Posts
    260 Views
    No one has replied
  • I have a problem with QTabWidget

    Unsolved
    4
    0 Votes
    4 Posts
    269 Views
    SGaistS
    @HelpForTabWidget not directly no. As @Christian-Ehrlicher suggested, it looks like a QToolBar.
  • Reusing some widgets or not?

    Solved
    5
    0 Votes
    5 Posts
    313 Views
    A
    @mpergand Thanks, for confirming my supposition. So I'll spare me the headache of trying to reuse those widgets...
  • qabstractitemmodeltester and editabletreemodel test failures

    Solved
    8
    0 Votes
    8 Posts
    1k Views
    J
    @StarterKit Yes, that "parent.column() > 0" check is necessary in the rowCount method. That is how I implemented it in all my TreeModels. I do: if(parent.isValid() && parent.column() > 0) return 0; Hope that helps.
  • The WindowDoesNotAcceptFocus flag is making me thirsty!!!!!!!

    Unsolved
    17
    0 Votes
    17 Posts
    6k Views
    Y
    I've encountered a similar problem. In my case, the widget continually activates and gains focus while being resized. I've set the following properties for the widget: setWindowFlags(Qt::ToolTip | Qt::FramelessWindowHint | Qt::WindowDoesNotAcceptFocus); setAttribute(Qt::WA_ShowWithoutActivating); This issue seems to occur only on Windows, and it doesn't happen before we upgrade to 5.15; I haven't experienced it on MacOS. My solution was to add Qt::BypassWindowManagerHint to the widget, and the widget won't get activated and focused anymore.