Skip to content

General and Desktop

This is where all the desktop OS and general Qt questions belong.
83.5k Topics 457.2k Posts
  • Qt "graphicalscene" and / or 3rd party graphical tool - any users here ?

    Unsolved
    1
    0 Votes
    1 Posts
    111 Views
    No one has replied
  • Changing tray Icon on signal

    Solved
    5
    0 Votes
    5 Posts
    302 Views
    _
    Client to instance instead of object and Client->moveToThread(thread); solved the problem
  • QSharedPointer is null with strongref existent

    Unsolved
    10
    0 Votes
    10 Posts
    638 Views
    JoeCFDJ
    @Redman is PlcAddress a subclass of QObject? If yes, do not forget to call QObject in its constructor and register its reference count.
  • QSqlTableModel fails to do submitAll()...

    Unsolved
    10
    0 Votes
    10 Posts
    702 Views
    H
    @JonB About - "You show a commented out section where you set values and did your own INSERT query." I wrote this code (now, comment out) because I wanted to check whether the database can insert a new line. If I don't drop table and reexecute my code, there is the newly inserted item. I thought I should have called submitAll function after that, but the result was the same ... That is to say, I must close my application once, and reboot. And about "I would start by setting all the fields of the inserted record (e.g. via QSqlRecord record = model.record(row); record.setValue(...); model.setRecord(row, record);) before submitting it. " I don't know what to do... This means I should set the values by using QSqlRecord again?
  • Native context menu on macOS

    Unsolved macos c++ objective-c menu
    1
    0 Votes
    1 Posts
    624 Views
    No one has replied
  • Can't install Qt

    Unsolved
    4
    0 Votes
    4 Posts
    215 Views
    jsulmJ
    By following https://wiki.qt.io/Online_Installer_4.x "Selecting a mirror for opensource"
  • Disable scroll area in QTableView/QTableWidget

    Unsolved qtableview scroll scrollarea qscrollarea viewport
    5
    0 Votes
    5 Posts
    8k Views
    T
    table->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); table->setSizeAdjustPolicy(QAbstractScrollArea::AdjustToContents); setMinimumWidth(table->sizeHint().width());
  • QT Desktop Environment

    Unsolved c++ qt linux desktop linux
    5
    0 Votes
    5 Posts
    2k Views
    SGaistS
    @rsmwall hi and welcome to devnet, Did you already check the projects I linked (agreed they are non trivial) ? Do you really intend to create a new DE or do you just need something more fancy than a single window application in which case the Qt Wayland module might be of interest.
  • Update UI from a C++ library callback

    Solved
    6
    0 Votes
    6 Posts
    725 Views
    S
    @SamiV123 said in Update UI from a C++ library callback: I'd make your callback implementation post a new Event to the Qt event queue. This is the most reasonable approach. Connections of signals/slots between threads just work. Another way is to just put everything into a lambda an send that to the GUI thread: void logCallback( DownloadLogPhase phase, int value) { QString msg = "?"; switch(phase) { case DL_PHASE_OK: qDebug() << "[logCallback] OK "; msg = "OK"; break; case DL_PHASE_OPENING: qDebug() << "[logCallback] OPENING "; msg = "Opening .."; break; case DL_PHASE_INIT: msg = "Init done!"; break; case DL_PHASE_DOWNLOADING: qDebug() << "[logCallback] DOWNLOADING " << value; msg = "Download " + QString::number(value); break; case DL_PHASE_ERROR: qDebug() << "[logCallback] ERROR " << value; // Codice UpdaterRet_* msg = "ERROR " + QString::number(value) + " - "; msg.append(Updater::GetUpdaterRetDescription((UpdaterRet)value)); break; default: qDebug() << "[logCallback] " << phase; msg = "NotHandled phase: " + QString::number(phase); } QMetaObject::invokeMethod(qGuiApp, [msg=msg]() { QWidgetList wl = QApplication::topLevelWidgets(); foreach(QWidget * widget, wl) { if (MainWindow* mw = qobject_cast<MainWindow*>(widget)) { mw->ui->listDownloadLog->addItem(msg); if (phase == DL_PHASE_DOWNLOADING) mw->ui->progressBar->setValue(value); break; } } }); } There is a non-zero chance that the order of these calls to the GUI thread is not kept. Have a look at the implementation of guiThread() in my library https://github.com/SimonSchroeder/QtThreadHelper for different ways how to synchronize with the GUI thread. If your progress calls get out of sync using a queue (schedule WorkerThread::ASYNC in my lib) is the best approach. The other two implementations will fully block the calling thread which is most likely not what you want.
  • Accessing in memory SQLite databse

    Unsolved
    10
    0 Votes
    10 Posts
    765 Views
    C
    @abhic Some possibilities: Sqlite was built with this SQLITE_OMIT_SHARED_CACHE option. Not sure: not looked at the relevant source. Maybe the shared in-memory database needs to be accessed by the same Sqlite library (I do not know how the rendezvous works). At the moment the Qt plugin is probably using built-in code, while the "outside Qt" code may be using either a system library or its own built-in Sqlite.
  • Touchscreen failure after double click on file in QFileDialog

    Unsolved
    4
    0 Votes
    4 Posts
    452 Views
    galuoG
    I bypassed this bug, not use dialog.exec(), but dialog.open()
  • Error 400: redirect_uri_mismatch using google OAuth

    Unsolved
    10
    0 Votes
    10 Posts
    1k Views
    D
    I set the port to 80 in the cloud console. Now it looks like http://127.0.0.1:80/cb the qDebug() says QUrl("http://127.0.0.1:80/cb") but the error on google side stays the same Error 400: redirect_uri_mismatch You cannot log in to this app because it does not comply with Google's OAuth 2.0 rules. If you are the programmer of the application, register the Google Cloud Console URI for redirect. Application details: redirect_uri = http://127.0.0.1:0/
  • How to implement Flow layout in a Group Box.

    Solved
    6
    0 Votes
    6 Posts
    562 Views
    A
    @JonB hey i got it working thank you for your help!!
  • This topic is deleted!

    Unsolved
    1
    0 Votes
    1 Posts
    5 Views
    No one has replied
  • How to display huge point cloud via QT?

    Unsolved
    8
    0 Votes
    8 Posts
    2k Views
    H
    @Winz-0 If just for purpose of display point clouds, the method you mentioned is reasonable. my purpose is to debug the algorithm, so it can't discard some ponit cloud.
  • Line spacing in QTextEdit

    Unsolved
    6
    0 Votes
    6 Posts
    1k Views
    JonBJ
    @Devik said in Line spacing in QTextEdit: bf.setLineHeight(50, QTextBlockFormat.LineDistanceHeight) bf.setLineHeight(lineSpacing, QTextBlockFormat.LineDistanceHeight) If this is your actual code you should get NameError: name 'lineSpacing' is not defined error. If this is not your actual code then we don't know what your code really is. Please only post code which is actually copied & pasted from what you are really testing! The following works fine for me: import sys from PySide2 import QtWidgets, QtGui if __name__ == '__main__': app = QtWidgets.QApplication(sys.argv) textEdit = QtWidgets.QTextEdit() textEdit.show() textEdit.setText('Sample text Sample text Sample text Sample text Sample text Sample text Sample text ' 'Sample text Sample text Sample text Sample text Sample text Sample text Sample text') bf = textEdit.textCursor().blockFormat() bf.setLineHeight(50, QtGui.QTextBlockFormat.LineDistanceHeight) # bf.setLineHeight(lineSpacing, QtWidgets.QTextBlockFormat.LineDistanceHeight) textEdit.textCursor().setBlockFormat(bf) sys.exit(app.exec_()) [image: af802165-8aa6-4a4a-aa7b-a057f9664c7b.png] Tested under Ubuntu 22.04, PySide2, Qt5.15. That's all I have.
  • QJSEngine with ConsoleExtension and LoggingCategory

    Unsolved
    1
    0 Votes
    1 Posts
    62 Views
    No one has replied
  • widget size and position issues when on windows 11

    Unsolved
    8
    0 Votes
    8 Posts
    728 Views
    jsulmJ
    @Blackzero said in widget size and position issues when on windows 11: but I specify the maximum size and minimum size To all widgets? If so, then what's the point to resize the window? Or do you set max/min sizes when window if resized? If so - why? Why not simply use layouts?
  • call the dialog inside the loop

    Unsolved
    6
    0 Votes
    6 Posts
    439 Views
    jsulmJ
    @Blackzero said in call the dialog inside the loop: but when the dialog appears the application becomes "Not responding" But does the dialog work? You're using exec() which means you're using the dialog as a modal dialog - the application is blocked until the dialog is closed.
  • QOpenGLWidget gives incorrect h & w values.

    Unsolved
    5
    0 Votes
    5 Posts
    310 Views
    Chris KawaC
    i couldnt understand what u meant by native surface creation Both Qt and OpenGL draw to OS provided surfaces e.g. a window identified by a window handle (HWND). Because of reasons I won't get into here your main window and QOpenGLWidget don't share that resource but create one for each and composite them over one other (well, not necessarily true, but lets keep it simple). Creating those underlying surfaces is relatively costly (in terms of memory consumption, system resources and speed), so when you create a widget it doesn't immediately allocate them. It is deferred to the moment a widget is actually made visible. Until that time a geometry of a widget is unspecified. You can explicitly call e.g. setGeometry or resize, which do record a desired size, but that still doesn't allocate the native surface until the widget is made visible. I mean I am not querying it explicitly, The resizeGL() function is never called explicitly and is always called by the Qt framework Both code snippets you've shown set up the widgets in the main window constructor, so they are shown at the same time and there is only one call to resizeGL from the show() call of MainWindow. That shouldn't exhibit the behavior you describe, so there must be something else you're doing and not showing here. In your callstack window right click anywhere and from the context menu tell it to show external code. It will show you what in your main() is calling resizeGL.