Skip to content

General and Desktop

This is where all the desktop OS and general Qt questions belong.
83.4k Topics 456.4k Posts
  • QAxObject and Excel

    Unsolved
    29
    0 Votes
    29 Posts
    13k Views
    K
    @JonB, the query is actually irrelevant, I just need to get the cell's address. I have an application that validates columns and lists cells that have wrong values. The validation result is the address and a failure message so the user knows exactly where the error occurs and what has to be fixed directly in a checked file. SQL/ODBC queries compare columns faster than QAxObjects, but results lack addresses. The addresses don't have to be in an Excel manner like A12 etc., it can be a row/column number from the sheet.
  • Why emitting signal can cause a segmentation fault?

    Unsolved
    5
    0 Votes
    5 Posts
    1k Views
    JonBJ
    @CuriousPan Need to emphsize what @mchinand has written: you need to look around the debugger's windows/panes till you find the Stack Trace one. It shows which functions were calling which when the crash happened. Look back up till you find it's telling you a line in your code, look at that.
  • How to build Qt with clang under windows?

    Unsolved clang building qt qt 5.15
    4
    0 Votes
    4 Posts
    986 Views
    Christian EhrlicherC
    @Crazy-Sage said in How to build Qt with clang under windows?: Clang 7.0.0 And you're sure this ancient compiler supports all MSVC commands when you use clang-cl. What do you think you will gain when you compile Qt with clang-cl at all?
  • QDial doesn't stop at end point issue

    Unsolved
    7
    0 Votes
    7 Posts
    535 Views
    Christian EhrlicherC
    @Eric-Singer said in QDial doesn't stop at end point issue: This should be corrected in a future release, at least by option. I don't have this problem but also don't have https://doc.qt.io/qt-5/qdial.html#wrapping-prop set to true. Please provide a minimal, compilable example where you can show your issue.
  • Is it safe to call QThread::start() many times?

    Solved
    5
    0 Votes
    5 Posts
    469 Views
    Pl45m4P
    @qwe3 said in Is it safe to call QThread::start() many times?: if(QThread::currentThread()->isInterruptionRequested()) { return; } Looks good. https://doc.qt.io/qt-5/qthread.html#isInterruptionRequested
  • Build Qt6 from Conan Center

    Unsolved
    1
    0 Votes
    1 Posts
    208 Views
    No one has replied
  • SQLite integration with Qt Widgets

    Unsolved
    3
    0 Votes
    3 Posts
    433 Views
    Pl45m4P
    @Swati777999 To extend @JonB answer: Depends on what you really want to display and how your data / database looks like. If you have a single and more or less simple database table, have a look at QSqlTableModel https://doc.qt.io/qt-5/qsqltablemodel.html#details or even QSqlQueryModel, for even more simple, read-only SQL database access queries. https://doc.qt.io/qt-5/qsqlquerymodel.html#details For anything further than that, you probably need to write your own database model + view (to change/insert data using your graphical representation of your data).
  • Change border color on primitive element

    Unsolved
    1
    0 Votes
    1 Posts
    111 Views
    No one has replied
  • Are singletons considered good or bad for some config

    Unsolved
    13
    0 Votes
    13 Posts
    2k Views
    kshegunovK
    @Thank-You said in Are singletons considered good or bad for some config: So I wanted to know how it does and work and is it good or not. But I wanted to know other methods only I was intending not to take part in this one, but what can I say, I'm a masochist. The Qt way™ is what Christian posted, however his comment is true only partially. The initialization of the global is thread-safe, the object behind is not. So if one assumes that the variable is going to be used from multiple threads then making the construction/destruction thread-safe is only half the job. So I'll preach what I usually preach: don't use a singleton if you can avoid it. It's more trouble than it's worth, and ultimately it's worth very little to begin with.
  • Docking widgets in the parent widget.

    Unsolved
    16
    0 Votes
    16 Posts
    1k Views
    JonBJ
    @jenya7 said in Docking widgets in the parent widget.: I consider to stick to a console application. That would seem to be a most retrograde step! Your current application achieves (or attempts to achieve) an awful lot more than a response-by-response command-line program would. For a first UI application it does quite a lot (tabs, frames, widgets...), so it might be expected that it would take a bit of time to get it right. Effort which will aid you in future UI additions. So as @jsulm says from where you are now it would be good if you choose to persist with the UI.
  • How to popup a message box when QAbstractModel::setData got invalid data?

    Solved
    17
    0 Votes
    17 Posts
    970 Views
    SGaistS
    @jronald said in How to popup a message box when QAbstractModel::setData got invalid data?: How to disable "Enter" conditionally? Tie it to a validator's validity state. @jronald said in How to popup a message box when QAbstractModel::setData got invalid data?: A message box can tell the user what's wrong, it is helpful. A UI that is explicit with regard to what it expects is better. Do you really like to enter information in an application to just to have a message tell you that you have to do it all over again because of various constraints ? Constraints that are usually lost as you need to close the dialog to access the UI again ? Make things simple and clear: If you need a number in a range use a QSpinBox If you need a line of text with requirements use a QLineEdit with a suitable validator. Add an icon beside it with a QToolTip giving the expected input or a label underneath it with that advice.
  • Connecting two QWidget with QMouseEvents

    Solved
    3
    0 Votes
    3 Posts
    242 Views
    W
    @jsulm Thanks, I can do this!
  • 0 Votes
    1 Posts
    329 Views
    No one has replied
  • Debugging in Qt program in Qt Creator

    Unsolved
    3
    0 Votes
    3 Posts
    237 Views
    A
    I have added the following to my .pro file . message ("removed all subdirs here Nov 17 no differnce ") SUBDIRS += \ # ../../../../../BACKUP/CAT-28-3/PROJECTS/CAT_FT857_BLUETOOTH/CAT_FT857_BLUETOOTH_MAIN_PROJECT/TEST_MDI/TEST_MDI.promessage(:dupressdd complier warningsd \ # ../../EXAMPLES_COPY_5.x/Examples/Qt-6.2.0/bluetooth/btchat/btchat.pro \ # ../../Examples/Qt-5.15.2/bluetooth/btscanner/btscanner.pro message("supress all warnings ") QMAKE_CXXFLAGS += -w #QMAKE_CXXFLAGS_WARN_OFF message ("verbose output compiler ") QMAKE_LFLAGS += -v message ("verbose output linker ") QMAKE_CXXFLAGS += -Wl, --verbose message (" disable qDebug messages") #//CONFIG += console #DEFINES += QT_NO_DEBUG_OUTPUT It is somewhat redundant or stupid , take your pick. I use heavily #ifdef BYPASS useless old code but sometime prevents making same mistake #endif then old stand by #define DEBUG #ifdef DEBUG trace / debug notes .... #endif Best debug tool for(;;) comment your code PS Anybody care to add how to "remove all break points", senior moment. PPS I cannot be held responsible for the messed-up text...
  • Modbus Com in different thread

    Solved
    12
    0 Votes
    12 Posts
    1k Views
    S
    because m_modbusDevice is created in the constructor of ModbusCom and ModbusCom is instanced in mainthread. So m_modbusDevice is the object belonging the mainthread, and its timeout QTimer can't be worked propertly. To fix that, try to create the m_modbusDevice in m_thread, for exaple: class ModbusCom { QModbusRtuSerialMaster* m_modbusDevice; void initModbus() { m_modbusDevice=new QModbusRtuSerialMaster();//created in m_thread //other initialization code... } } connect(SerialComWorker,SIGNAL(startModbus()), m_modbus,SLOT( initModbus()); //then initModbus() function will excute in m_thread and m_modbusDevice will be m_thread's obejct. m_thread.start(); emit startModbus();
  • QTcpSocket can not bind to specified net card

    Solved
    7
    0 Votes
    7 Posts
    580 Views
    C
    @Christian-Ehrlicher I have sovled the problem by your suggestion,thanks a lot
  • How to use resource files without using .ui or form files in Qt?

    Unsolved
    12
    0 Votes
    12 Posts
    748 Views
    Pl45m4P
    @Swati777999 Show what you've done so far. Have you added your rc-file to your project?
  • This topic is deleted!

    Unsolved
    3
    0 Votes
    3 Posts
    19 Views
  • How to get QT's Debug information in msvc Vs2015?

    Unsolved
    3
    0 Votes
    3 Posts
    396 Views
    SGaistS
    Hi, It depends. Unless you need some special processing done by OpenCV you might want to consider using the QtMultimedia module.
  • Set a stylesheet for QColorDialog

    Solved
    9
    0 Votes
    9 Posts
    1k Views
    S
    Hi, so I just now realised, that I've made a mistake in my code example. Everytime you click cancel the color that it returns is black. EDIT: It's a problem because I'm setting a widgets color, and when I click cancel, it sets without me wanting it to. Here it's fixed: QString color; QColorDialog pick; pick.setStyleSheet("stylesheet"); pick.setCurrentColor("10, 255, 10"); //optional if (pick.exec() == QColorDialog::Accepted) { QColor const color = pick.selectedColor().name(); color = color.name(); qDebug() << color; } Another EDIT: Here's an example of 2 different stylesheets: Light mode: QColorDialog {background-color: rgb(244, 244, 244);} QPushButton {background-color: rgb(244, 244, 244); color: black;} QLabel {background-color: rgb(244, 244, 244); color: black;} QLineEdit {background-color: white; color: black;} QSpinBox {background-color: white; color: black;} Dark mode: QColorDialog {background-color: rgb(6, 6, 14);} QPushButton {color: rgb(211, 213, 201); background-color: rgb(36, 36, 44);} QLabel {color: rgb(211, 213, 201); background-color: rgb(6, 6, 14);} QLineEdit {color: rgb(211, 213, 201); background-color: rgb(36, 36, 44);} QSpinBox {color: rgb(211, 213, 201); background-color: rgb(36, 36, 44);}