Skip to content

General and Desktop

This is where all the desktop OS and general Qt questions belong.
83.4k Topics 456.4k Posts
  • Calling a process in the main app and return the process's window ID?

    Unsolved
    4
    0 Votes
    4 Posts
    1k Views
    Christian EhrlicherC
    @lansing said in Calling a process in the main app and return the process's window ID?: The problem I have is that I don't know how to get the window id of child process after I opened them. You create them, you communicate with them through shared memory and you've access to it's QProcess and therefore to it's stdout pipe - I think these are enough communication channels to pass the winid.
  • register mouse movement inside a particular window?

    Solved mouse mouseevent window signal movement
    2
    0 Votes
    2 Posts
    817 Views
    4
    Solved, overrode the standard event() and just used event.type() == QEvent::hovermove to get what I needed.
  • Check if buttons hidden on the widget

    Solved
    11
    0 Votes
    11 Posts
    3k Views
    mrjjM
    @Cobra91151 Well the continue is just optimization. if one is visible, no reason to check the others. Works the same checking all, though. Yeah, i guess so. even i didn't notice what but maybe both checking text and visibility in the same loop had some side effect.
  • How to use QObject in derived class

    Solved
    3
    0 Votes
    3 Posts
    261 Views
    I
    Thank you for the reply. I used Ui::MainWindow, because it didn't recognize MainWindow. Turns out i had a circular dependency issue with the #include files.
  • Can't debug with Qt 5.12.2 on Windows

    Unsolved
    7
    0 Votes
    7 Posts
    944 Views
    K
    I've submitted a bug report: https://bugreports.qt.io/browse/QBS-1433?jql=resolution %3D Unresolved AND reporter %3D currentUser()
  • QTableWidgetItem, emit signal when cell text changed.

    Solved
    10
    0 Votes
    10 Posts
    8k Views
    I
    Hello, I managed to do it using the last argument in QAbstractItemModel::dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight, const QVector<int> &roles) to fulfill the task. Just wanted to update this in case someone else needs it as it requires less manual work. connect(tableWidget->model(), &QAbstractItemModel::dataChanged, [this](const QModelIndex& index, const QModelIndex&, const QVector<int>& roles){ if (std::find(roles.begin(), roles.end(), Qt::EditRole) == roles.end())//wasn't caused by entering cell return; //rest of code
  • What sets resource.rc value assignments

    Unsolved project
    3
    0 Votes
    3 Posts
    785 Views
    mmikeinsantarosaM
    @Christian-Ehrlicher Thanks for the tip and will do. Mike
  • Can't close a QMenu opened through dbus by double clicking in another app

    Solved
    3
    0 Votes
    3 Posts
    415 Views
    fbg13F
    Solved it by adding QThread::msleep(150); to the dbus method before showing the menu.
  • TAB key is not working in PYQT5

    Unsolved
    14
    0 Votes
    14 Posts
    3k Views
    monamourM
    @Kent-Dorfman Many thanks,
  • why my widget does not redraw itself?

    Unsolved
    3
    0 Votes
    3 Posts
    561 Views
    aha_1980A
    Hi @Joshua-Qt, why do you actually want to mix MFC and Qt? You should be aware, that Qt (same as MFC) uses an event loop in background. If you want to combine both, both event loops must be run. That is surely not impossible, but advanced stuff that needs a deep understanding on what's going on in background. Regards
  • Video chat application on Windows 32 bit with Webrtc

    Unsolved
    1
    0 Votes
    1 Posts
    346 Views
    No one has replied
  • QSplashScreen - Focus lost

    Unsolved
    7
    0 Votes
    7 Posts
    1k Views
    SGaistS
    Tested on macOS but it's working fine... Can you test with the 5.13 preview ?
  • CAN Message

    Unsolved
    5
    0 Votes
    5 Posts
    620 Views
    martial123M
    don't worry, i have found how i can do that.. yes it's understand me but he need to configure to talk the same language. And to do that, i need to send him many trame on serial port . but i have understand how he did it with class : CANMessage can_message; he created the class, it's not a basic class .. so i need to re created the same class to allow me send the good trame ..
  • VARIANT structure in qt

    Unsolved
    4
    0 Votes
    4 Posts
    517 Views
    hskoglundH
    Hi, to get the size of the SAFEARRAY, because it's 2D, you need to ask for the lower and upper bounds of both the dimensions, say something like this: long iLBoundX, iUBoundX,iLBoundY, iUBoundY; char * data; SafeArrayGetLBound((*var_array.pparray),1,&iLBoundX); SafeArrayGetUBound((*var_array.pparray),1,&iUBoundX); SafeArrayGetLBound((*var_array.pparray),2,&iLBoundY); SafeArrayGetUBound((*var_array.pparray),2,&iUBoundY); SafeArrayAccessData((*var_array.parray),(void**)(&data)); long szX=iUBoundX-iLBoundX+1; long szY=iUBoundY-iLBoundY+1; Note: this is a just a guess!
  • can't add an object to a QList

    Solved
    2
    0 Votes
    2 Posts
    304 Views
    Chris KawaC
    You're trying to copy the object into the list. QObjects are not copyable. To fix this you can change the list to be a list of pointers instead.
  • Open Serial Port

    Solved
    4
    0 Votes
    4 Posts
    445 Views
    martial123M
    Yes i have see that befor your answer ^^ its COM3 and not portname When i setPortName ty !
  • 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.