Skip to content

General and Desktop

This is where all the desktop OS and general Qt questions belong.
83.4k Topics 456.4k Posts
  • Argument in connect

    Solved
    16
    1 Votes
    16 Posts
    10k Views
    mrjjM
    @martial123 well before using them, read a bit about it. It is not super complicated and can save you some slots. The capture part sounds odd, but basically we just list [var1, var2,var3 ] to have them avialable inside the lambda. It is a free-floating function so it's not part of the class like a slot is.
  • This topic is deleted!

    Solved
    5
    0 Votes
    5 Posts
    50 Views
  • Get an Instances

    Solved
    13
    0 Votes
    13 Posts
    2k Views
    martial123M
    @jsulm I have tried to work with return instance but i have not succeeded ...
  • QUdpSockets and Windows 10

    Solved
    18
    0 Votes
    18 Posts
    3k Views
    mzimmersM
    No, I want the signal for when the remote device responds to my send. I realize I was making the code unnecessarily complicated; here's my current version: // create the socket, bind to it and set some options. m_sock = new QUdpSocket(this); rc = m_sock->bind(m_addrRecv, MCAST_PORT, QAbstractSocket::ShareAddress | QAbstractSocket::ReuseAddressHint); if (rc == false) { cout << m_sock->errorString().toStdString() << endl; exit(1); } m_sock->setSocketOption(QAbstractSocket::MulticastLoopbackOption, 0); // join multicast group. rc = m_sock->joinMulticastGroup(m_addrSend); if (rc == false) { cout << m_sock->errorString().toStdString() << endl; exit(1); } QObject::connect(m_sock, &QUdpSocket::readyRead, this, &UdpSocket::recv); QObject::connect(m_sock, &QUdpSocket::disconnected, this, &UdpSocket::reconnect); qnil = QNetworkInterface::allInterfaces(); for (it = qnil.begin(); it != qnil.end(); ++it) { type = it->type(); if (type == QNetworkInterface::Ethernet) { //m_socketInterfaceMap.insert(m_sock, *it); qDebug() << it->humanReadableName() << type; m_sock->setMulticastInterface(*it); send(str); } } My concern now is that I'm not getting any hit on my recv() slot. Once I get that working, I can work out the matter of determining which interface was used, using the technique you described above. EDIT: I simplified it further, by only writing to the interface I know is correct, and I still don't get a recv() trigger. I think I must have messed up something in my multicast setup. EDIT 2: I found the problem -- evidently, even if you choose an interface for a socket, when you call joinMulticastGroup, you still have to specify the interface, or the OS will choose one for you. With the change below, I'm now getting my recv() slot. for (it = qnil.begin(); it != qnil.end(); ++it) { type = it->type(); // if (type == QNetworkInterface::Ethernet) if (it->humanReadableName() == "Ethernet 3") { //m_socketInterfaceMap.insert(m_sock, *it); qDebug() << it->humanReadableName() << type; m_sock->setMulticastInterface(*it); // join multicast group. rc = m_sock->joinMulticastGroup(m_addrSend, *it); Now I just have to use that stuff that SGaist suggested above to determine which interface supplied the response.
  • QSqlDatabase - save/retrieve database to/from hard disk

    Solved
    7
    0 Votes
    7 Posts
    2k Views
    mrjjM
    @simozz Hi Just a small note. You can use qApp->applicationDirPath(); to get the path where exe is. Normally that is in the build folder. ( when you develop) So you can use this to have a path to the DB that is always valid. even on other machine.
  • Delete old dirs

    Solved
    14
    0 Votes
    14 Posts
    2k Views
    ODБOïO
    @J.Hilk i can't not find a way to emit a signal from the static function.. but i think simply delaying the deletion of the QThread is enought for my usecase, deleteOldDirs2() will take 5-s seconds maximum (+the object is created only once and the app will restard automatically every 5 hours so no memory increase). QThread *th = QThread::create(deleteOldDirs2); th->start(); QTimer::singleShot(20000, [=]() { // 20sec must be safe th->deleteLater(); });
  • Problem with enable method for QPushButton

    Solved
    3
    0 Votes
    3 Posts
    387 Views
    B
    Thank you for this.
  • Does not work QT += webenginewidgets and # include < QtWebEngineWidgets>

    Unsolved
    4
    0 Votes
    4 Posts
    4k Views
    mrjjM
    Hi Just a tiny Question. Even VS2015 is compatible with VS2017, in this case it must be 2017 version ?
  • QGraphicsItem resizing approach

    Unsolved
    2
    0 Votes
    2 Posts
    424 Views
    raven-worxR
    @faiszalkhan this might be of interest for you
  • mouseRelease doesn't work

    Solved
    15
    0 Votes
    15 Posts
    2k Views
    mrjjM
    well there was a typo if (WM_NCLBUTTONDOWN ) { should have been if (msg->message == WM_NCLBUTTONDOWN ) { so it would always say it was clicked. Update: You are right - it's not sending the WM_NCLBUTTONUP I assume left click starts a drag, and no UP event will be seen since windows then do a mouse capture. So sorry. forget they code. it cannot work for what you want since you will never get the UP event.
  • 0 Votes
    5 Posts
    3k Views
    K
    Thanks but I asked same question on StackOverflow https://stackoverflow.com/questions/55471486/how-can-i-set-maximum-width-to-which-qscrollarea-within-qdialog-will-expand-wi/ The reason of such behaviour is cause QScrollArea::sizeHint() has boundedTo(QSize(36 * h, 24 * h)) , where h is fontMetrics().height(), at the end of implementation. So reimplementing sizeHint() is doing the job just fine
  • compile error occurs with opengl functions in webassembly env.

    Solved
    6
    0 Votes
    6 Posts
    928 Views
    C
    WebAssembly uses WebGL while both OpenGL and WebGL are not same. Different function systems are there. glDrawArrays can draw lines instead of calling glVertex3f continuously in boundary of glBegin and glEnd. I am answering my own question.
  • Qmake: Possibility to skip "Select Qt edition" question ?

    Unsolved
    2
    0 Votes
    2 Posts
    348 Views
    sierdzioS
    Do you have qmake installed? Try running configure in your terminal once before opening the .pro file. By the way, why do you try to open qtbase.pro in Qt Creator?
  • Digits displaying issue in pyqt

    Solved
    5
    0 Votes
    5 Posts
    559 Views
    monamourM
    @SGaist Thank you so much.
  • Printing does not work in installation package

    Solved
    7
    0 Votes
    7 Posts
    959 Views
    ZgemboZ
    @SGaist said in Printing does not work in installation package: windeployqt Yes. I have tried to copy all the files and folders that were generated and it works now. Thank you.
  • How print in zebra printer with qt(or a diferent way in c++).

    Unsolved
    2
    0 Votes
    2 Posts
    733 Views
    jsulmJ
    @Kmitsu I never used Zebra and I as far as I know Qt does not support it directly. I found this: https://github.com/zeromq/zebra/tree/master/bindings/qt Maybe you can use it. As alternative: can you use Zebra to print to PDF or Postscript first and then print this PDF/Postscript via Qt?
  • QPrint Error.

    Unsolved
    4
    0 Votes
    4 Posts
    430 Views
    P
    @mrjj Eze wrote it down wrong. Eze is the output.
  • Is there a tag line edit widget in Qt?

    3
    0 Votes
    3 Posts
    2k Views
    N
    Also check out https://github.com/nicktrandafil/tags
  • How to run qt program tray display with root

    Unsolved
    4
    0 Votes
    4 Posts
    589 Views
    SGaistS
    Hi and welcome to devnet, From what I remember, by default access to the X server is disabled for root for security reasons. You have to explicitly allow it.
  • PyQT5 kernel getting dead while launching a simple programme..

    Unsolved
    2
    0 Votes
    2 Posts
    353 Views
    SGaistS
    Hi and welcome to devnet, What version of PyQt5 are you using ? What version of Qt is it built on ? How did you install both of them ? What Linux flavour are you running ? What graphics card do you have ? What driver are you using for it ? What do your kernel logs tell you ?