Skip to content

General and Desktop

This is where all the desktop OS and general Qt questions belong.
83.5k Topics 456.8k Posts
  • Fastest way to render a VideoFrame?

    Unsolved
    6
    0 Votes
    6 Posts
    2k Views
    SGaistS
    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
    4
    0 Votes
    4 Posts
    687 Views
    SGaistS
    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
    11
    0 Votes
    11 Posts
    2k Views
    SGaistS
    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.
  • QSerialPort::availablePorts reports portName available after unplugging

    Solved
    14
    0 Votes
    14 Posts
    1k Views
    J
    @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
    18
    0 Votes
    18 Posts
    19k Views
    O
    @sierdzio Thanks, I am learning even more. I made that change. Any other wise tips, the would be gratefully accepted.
  • QWidget not response on ComboBox action

    Solved qwidget combobox signal & slot
    4
    0 Votes
    4 Posts
    883 Views
    Christian EhrlicherC
    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
    0 Votes
    2 Posts
    247 Views
    Christian EhrlicherC
    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
    4
    0 Votes
    4 Posts
    2k Views
    N
    @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
    9
    1 Votes
    9 Posts
    873 Views
    Christian EhrlicherC
    @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
    4
    0 Votes
    4 Posts
    502 Views
    mrjjM
    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
    6
    0 Votes
    6 Posts
    976 Views
    SGaistS
    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
    0 Votes
    2 Posts
    367 Views
    VRoninV
    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
    1
    0 Votes
    1 Posts
    411 Views
    No one has replied
  • GUI design - how to properly activate "whats this" help

    Unsolved
    2
    0 Votes
    2 Posts
    1k Views
    mrjjM
    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
    20
    0 Votes
    20 Posts
    5k Views
    rkhaotixR
    @mrjj Yeah... I'm aware of that entry on PostgreSQL wiki :D
  • 0 Votes
    35 Posts
    10k Views
    E
    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?
  • Strange crash with QObject hierarchy deletion

    Unsolved
    16
    0 Votes
    16 Posts
    4k Views
    kshegunovK
    @pozdnyakov said in Strange crash with QObject hierarchy deletion: But it's nice to know that I've found a bug and it's not just some misunderstanding on my side. It's been making me crazy for the last day or so :) Thiago says it won't be fixed. So act accordingly.
  • QImage

    Unsolved
    8
    0 Votes
    8 Posts
    940 Views
    mrjjM
    @satyanarayana143 Sure https://www.dropbox.com/s/fladys1ao8cj5gq/centerlabel.zip?dl=0
  • Timer problem

    Unsolved
    7
    0 Votes
    7 Posts
    2k Views
    JonBJ
    @kshegunov Yes! Just what I want! :)
  • how to decrypt a encrypted data?

    Unsolved
    10
    0 Votes
    10 Posts
    2k Views
    VRoninV
    @ManiRon said in how to decrypt a encrypted data?: want to encrypt both password Very easy to understand yet informative: https://www.youtube.com/watch?v=8ZtInClXe1Q