Skip to content

General and Desktop

This is where all the desktop OS and general Qt questions belong.
83.5k Topics 457.3k Posts
  • Connecting two QWidget with QMouseEvents

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

    Unsolved
    3
    0 Votes
    3 Posts
    253 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
    619 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
    804 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
    407 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);}
  • REST request with an regular expressions in a URL

    Unsolved
    9
    0 Votes
    9 Posts
    2k Views
    M
    @Beatnicker said in REST request with an regular expressions in a URL: "http://192.168.0.125:8086/rest/channel/.*/.*Temperature" It's interesting that only your first wildcard in your url is being removed when sending via Qt. Not sure why that is though.
  • Question with Debugger used in QtCreator

    Unsolved
    2
    0 Votes
    2 Posts
    169 Views
    L
    One other point, when I single step the same code using VS2019, it steps over properly. I wonder if some setting is missing.
  • Adding QT Plugin WSL in visual studio

    Unsolved
    1
    0 Votes
    1 Posts
    209 Views
    No one has replied
  • How scroll to a specific html tag in QTextEdit?

    Unsolved
    4
    0 Votes
    4 Posts
    461 Views
    artwawA
    @abdoll78 solution is to parse your source text, add anchors in it, then set.
  • Convert a QDate to BCD Format (Binary-coded decimal) for QByteArray

    Solved
    3
    0 Votes
    3 Posts
    901 Views
    P
    Wow ok, I expected my code to be too complicated. But not at this point ^^. Thanks and have a nice day.
  • Invisible QLineEdit receive Focus?!?

    Solved
    11
    0 Votes
    11 Posts
    1k Views
    D
    Just to close this: I solved the problem with this solution
  • Creating mockobject of Qfile by replacing Qbuffer possible?

    Solved
    4
    0 Votes
    4 Posts
    230 Views
    C
    Thank you so much for explaining! It works to pass QFile and QBuffer like that.
  • Which control to use for this kind of report?

    Solved
    4
    0 Votes
    4 Posts
    431 Views
    D
    @mpergand, forgot that! used that in QueryLite. With these: tree->header()->setSectionResizeMode(0, QHeaderView::Stretch); tree->header()->setSectionResizeMode(1, QHeaderView::ResizeToContents); tree->header()->setSectionResizeMode(2, QHeaderView::ResizeToContents); no need to calculate the width of text in columns and I can get rid of that resizeEvent.
  • convert accented characters from unicode at UTF-8

    Solved
    18
    0 Votes
    18 Posts
    4k Views
    elicatE
    @elicat yes, I did
  • How do I make a QLabel Blink?

    Unsolved qt6.1.2 qtimer qlabel mainwindow windows 10
    5
    0 Votes
    5 Posts
    2k Views
    JonBJ
    @DougyDrumz2 said in How do I make a QLabel Blink?: The consensus is evidently to l hide and show a QLabel Not my "consensus :) So far as I am aware, hiding can cause different layout redraw in at least some circumstances. I retain visibility but toggle foreground color to QColor(Qt::transparent) or toggle alpha color value between 255 (opaque) and 0 (transparent) on palette QPalette::setColor(QPalette::Text, colour). Also, creating multiple QTimer::singleShot()s doesn't scale very well if you want to change the number of flashes or the interval between. Or of you have multiple labels to blink and you'd like them all to be "in sync". I use one regular repeating QTimer with a "countdown" and cancellation when it reaches 0. Up to you on both of these.
  • 0 Votes
    2 Posts
    160 Views
    sierdzioS
    Well then don't define multiple text streams, right? Each operation on a file will move the current position in the QFile object, so from that perspective what you describe seems OK. Maybe share the relevant piece of code and we'll be able to help then.