Skip to content

General and Desktop

This is where all the desktop OS and general Qt questions belong.
83.4k Topics 456.4k Posts
  • audio call app not working

    Unsolved 1 Nov 2018, 06:45
    0 Votes
    11 Posts
    1k Views
    @Dimple thats exactly the bug @mrjj described. fixing that needs a debugger, some experience and time ;)
  • Unknown Module(s) in QT: charts

    Solved 3 Nov 2018, 03:03
    0 Votes
    2 Posts
    509 Views
    @R_Irudezu I had more than one version of Qt so i uninstalled all of them and installed lates version 5.12. Now QtChart header can be involving.
  • Communicate with non-member function

    Solved 1 Nov 2018, 07:47
    0 Votes
    13 Posts
    3k Views
    MainWindow *w = new MainWindow; Make the variable w as member variable. Then delete it when you don't require the object any more.
  • Make a line break in a layout or container

    Solved 2 Nov 2018, 02:22
    0 Votes
    25 Posts
    5k Views
    @mrjj said in Make a line break in a layout or container: Try to follow the steps and build the same. It looks more complicated than it is. All right, I'll take your advice, anyway, thank you for your answers and I can put the subject as resolved.
  • Fastest way to render a VideoFrame?

    Unsolved 21 Feb 2018, 13:58
    0 Votes
    6 Posts
    2k Views
    Hi, sorry, no I don't. I went it hardcore style and looked at the various camera backend implemented by Qt. You'll see that it's not that complicated to put together.
  • QSqlTableModel and lock a record

    Unsolved 2 Nov 2018, 16:31
    0 Votes
    4 Posts
    680 Views
    Hi, What I would try is to make the SELECT for UPDATE query in a slot connected to the beforeUpdate. You need a direct connection (which is the default unless you are using objects in different threads).
  • Using QTimer in main

    Unsolved 31 Oct 2018, 07:34
    0 Votes
    11 Posts
    2k Views
    You should always check the return value of exec and print the error if it fails. Also, QSqlQuery usage pattern is on the stack not on the heap. See the Approaches to Binding Values from QSqlQuery's documentation.
  • 0 Votes
    14 Posts
    1k Views
    @Jeff-Barnes #include "jtagclient.h" #include <unistd.h> #include <QSerialPortInfo> #include <QTimer> QString JtagClient::m_usbDevice = "ttyUSB0"; JtagClient::JtagClient(QObject *parent) : QObject(parent) { m_serialPort = new QSerialPort(m_usbDevice); } void JtagClient::run() { if (!m_serialPort->open(QIODevice::ReadWrite)) { emit usbDeviceStatus("Could not open serial port"); return; } QTimer *tm = new QTimer; QTimer *retmr = new QTimer; tm->setInterval(500); tm->setSingleShot(false); retmr->setInterval(500); retmr->setSingleShot(false); QObject::connect(this, &JtagClient::stopDisconnectTimer, tm, &QTimer::stop); QObject::connect(this, &JtagClient::stopReconnectTimer, retmr, &QTimer::stop); QObject::connect(this, SIGNAL(startReconnectTimer()), retmr, SLOT(start())); QObject::connect(this, &JtagClient::finished, tm, &QTimer::deleteLater); QObject::connect(this, &JtagClient::finished, retmr, &QTimer::deleteLater); QObject::connect(tm, &QTimer::timeout, [&]() { bool found = false; foreach (QSerialPortInfo inf, QSerialPortInfo::availablePorts()) { if (m_usbDevice == inf.portName()) { emit usbDeviceStatus("Waiting for usb serial disconnect"); found = true; break; } } if (!found) { m_serialPort->close(); m_serialPort->deleteLater(); emit usbDeviceStatus("Cable removed"); emit stopDisconnectTimer(); emit startReconnectTimer(); } }); QObject::connect(retmr, &QTimer::timeout, [&]() { bool found = false; foreach (QSerialPortInfo inf, QSerialPortInfo::availablePorts()) { if (m_usbDevice == inf.portName()) { found = true; //500000 causes a Permission denied error, presumably the kernel hasn't finished the inode //750000 causes a Permission denied error for ReadWrite, but works for ReadOnly //usleep(750000); sleep(1); m_serialPort = new QSerialPort(m_usbDevice); if (!m_serialPort->open(QIODevice::ReadWrite)) { emit usbDeviceStatus(QString("Could not re-open device: %1").arg(m_serialPort->errorString())); } else { emit usbDeviceStatus("Connection re-established"); } break; } } if (found) { emit stopReconnectTimer(); emit finished(); } else emit usbDeviceStatus("Waiting for re-connect"); }); tm->start(); }
  • Lambda that uses signal argument to connect to a slot

    Solved 31 Oct 2018, 19:02
    0 Votes
    18 Posts
    19k Views
    @sierdzio Thanks, I am learning even more. I made that change. Any other wise tips, the would be gratefully accepted.
  • 0 Votes
    4 Posts
    872 Views
    I said 'Maybe you've a typo...' The problem with auto-connect is that you can not be sure if it is really connected (e.g. when there is a typo somewhere in the functions signature or the ui element name) and it easily breaks (e.g. when renaming an ui element).
  • Qt5Http not working

    Unsolved 2 Nov 2018, 20:12
    0 Votes
    2 Posts
    243 Views
    You should not use this blocking wait but connect to QNetworkReplay::finished() or similar. See http://doc.qt.io/qt-5/qnetworkaccessmanager.html#details for more details on how to do it.
  • multiple access to database qt sqlite3

    Moved Unsolved qt 5.6 sqlite3 2 Nov 2018, 11:21
    0 Votes
    4 Posts
    2k Views
    @JonB I'm sorry, I thought it would be helpful if people saw the entirety of the code. I didn't know which part of the code I was lacking. Ohhh. thank you for the instruction. I'll work on the changes.
  • single letter variable names

    Unsolved 2 Nov 2018, 17:40
    1 Votes
    9 Posts
    854 Views
    @jon_rurka said in single letter variable names: people reading the code who are curious what this object is. It's perfectly clear from the context - it's the private data of the class you're looking at. See https://wiki.qt.io/D-Pointer
  • Drawing visual acuity E test

    Unsolved im using qt cr ator 2 Nov 2018, 15:30
    0 Votes
    4 Posts
    502 Views
    Hi I would just create the the Es symbols in inkscape and save as svg. QLabel can be used to both display the Text ( with different font size) and can also show SVG image. SVG is vector and can be shown in any size. Is each "row" always the same so each row can be premade or does app need to put a row together with random symbols? What are the rule for the 20/200 number. would next row (3) be 20/50 ? is this the full symbol set ? ( just E rotated 4 times ) [image: e89hCh.png] Also how do you tell app is to show single big E, a row or multiple rows? Just like 3 buttons to show or would it be random ? Also the sizes seems important (of the Es ) [image: 716_9912_popup.jpg] So you would need some sort of reference size to display it at say 25%
  • File in QtResource file not found

    Unsolved 2 Nov 2018, 12:30
    0 Votes
    6 Posts
    964 Views
    You're welcome ! Since you have it working now, please mark the thread as solved using the "Topic Tools" button so that other forum users may know a solution has been found :-)
  • QTcpServer across threads

    Unsolved 2 Nov 2018, 13:06
    0 Votes
    2 Posts
    361 Views
    from google I know that QTcpSocket must be created and accessed in the same thread This is not the case Have a look at this example: https://wiki.qt.io/WIP-How_to_create_a_simple_chat_application
  • Modbus: exception 0x5

    Unsolved 2 Nov 2018, 14:40
    0 Votes
    1 Posts
    410 Views
    No one has replied
  • GUI design - how to properly activate "whats this" help

    Unsolved 2 Nov 2018, 13:53
    0 Votes
    2 Posts
    1k Views
    Hi Well shift+F1 hovering mouse cursor over a widget Widgets will shows its WhatisThis property. Also works on QMenu items so should also works on context menu although i didnt test it. You can use setWindowFlags(Qt::Window | Qt::WindowContextHelpButtonHint | Qt::WindowCloseButtonHint); to set it on a MainWindow type window, but it wont have min/max then. Its not supported on/by Windows. alternatively , add it to status bar. auto button = new QPushButton("?"); button->setMaximumSize(32, 32); connect( button, &QPushButton::clicked, []() { QWhatsThis::enterWhatsThisMode(); } ); ui->statusBar->addPermanentWidget( button ); Works quite well. [image: LQB0PF.png] -- Normally people use tooltips which is supported in most places/types of windows. Adding a button to the titlebar is not possible with Qt. (alone)
  • QGraphicsScene performing "poorly" on dense scenes

    Solved 29 Oct 2018, 23:38
    0 Votes
    20 Posts
    5k Views
    @mrjj Yeah... I'm aware of that entry on PostgreSQL wiki :D
  • 0 Votes
    35 Posts
    10k Views
    I don't understand this question. How do you think about information from Cppcheck's forum and issue tracker? Do you care for software aspects which can be discussed there?