Skip to content

General and Desktop

This is where all the desktop OS and general Qt questions belong.
83.4k Topics 456.5k Posts
  • Insert Record in QSqlTableModel with QTableView

    Unsolved
    3
    0 Votes
    3 Posts
    5k Views
    I
    I tried this. Like this the record will be inserted in the database table, but somehow the table view is not updated correctly. It looks like this [image: daaae09e-b671-4b33-829d-9023b925d755.png] and I cannot edit the record. PS: Thank you for the hint of the database issue.
  • QUdpSocket readyRead never emitted

    Unsolved
    15
    0 Votes
    15 Posts
    6k Views
    T
    @ZF__ QAbstractSocket also provides signals bytesAbailable and bytesWritten.. First i suggest you to use qthreads.. networka aa; QThread * td = new Thread; aa.moveToThread(td); td.start(); Create udpsocket in networka and connect signals such as bytesAvailable, disconnected and other signals as below in networka QUDPSocket * udpSocket; // other connection related stuff... Connect(udpSocket,SIGNAL(bytesAvailable()),this,SLOT(readData())); // connect other signals ... implement slot in networka something like void readData(){ QByteArray ary = udpSocket.readAll(); // ary contains all data thats read... } this way you can get rid of while loop and corresponding slots will be connected on respective signals.. i.e., when bytes are available in socket, readData Slot will be called and you read data... PS: signals what i mentioned above may not be exact.. please check documentation for exact syntax.
  • QTime::elapsed() behavior

    Unsolved
    2
    0 Votes
    2 Posts
    1k Views
    JonBJ
    @Bart_Vandewoestyne Reading the docs, QTime::start() only says: "Sets this time to the current time". So startTime.start() is only doing exactly the same as QTime startTime = QTime::currentTime();. And presumably startTime.elapsed(); is only doing same as QTime::currentTime() - startTime. Hence your code works. For the old code, it's only using startTime, which it assigns, so the stand-alone statement QTime::currentTime(); has no effect. You'd have to ask the author :), but I would presume it was unintended.
  • DBUS_SESSION_BUS_ADDRESS with QDBusConnection

    Unsolved
    3
    0 Votes
    3 Posts
    952 Views
    N
    @raven-worx said in DBUS_SESSION_BUS_ADDRESS with QDBusConnection: @nxMan said in DBUS_SESSION_BUS_ADDRESS with QDBusConnection: I want to get DBUS_SESSION_BUS_ADDRESS value without checking envs of any process what do you mean with "without checking envs of any process"? I can find pid of a process wich will have DBUS_SESSION_BUS_ADDRESS env variable and obtain the dbus address from its environment. But I don't want this solution.
  • How to resize the main window again after setFixedSize

    Unsolved
    4
    0 Votes
    4 Posts
    1k Views
    S
    Why don't you use resize(int w, int h) function instead of setFixedSize(w,h) at the first place?
  • QT, repaint line that doesn't have boundingRect()

    Unsolved qt4 python2 boundingrect qgraphicsscene shape
    2
    0 Votes
    2 Posts
    1k Views
    mrjjM
    Hi I just keep a pointer to the "white lines" and adjust if i move yellow. class ColorItem : public QGraphicsItem { .. ConnectorLine* line = nullptr; .. protected: QVariant itemChange(GraphicsItemChange change, const QVariant& value) override { if (change == ItemPositionChange && scene()) { if (line) { line->adjust(); } } return QGraphicsItem::itemChange(change, value); } private: QColor color; }; line->Adjust() alters its endpoints. You could just adjust it directly here.
  • "GTK" warning for Native QFileDialog under Linux

    Solved
    12
    0 Votes
    12 Posts
    11k Views
    JonBJ
    @jsulm All makes sense now! I had assumed that a normal Qt (X11?) window/dialog would serve as the parent for (what turns out to be a GTK) native file dialog. Now I get the problem, and the reason for the warning!
  • QT widget is not visible properly

    Unsolved
    2
    0 Votes
    2 Posts
    469 Views
    joeQJ
    @CorD-SaC Hi,friend. Welcome. Could you move below code to void MainWindow::showEvent function, try it. QMovie *movie=new QMovie(":/res/icons/giphy.gif"); if (!movie->isValid()) { // Something went wrong :( } ui->labelGif->setMovie(movie); movie->start(); ui->widgetGif->setVisible(true);
  • 0 Votes
    2 Posts
    2k Views
    raven-worxR
    @payman i have no experience with accessibility on Linux. But maybe the following helps you: Qt Accessibility is based on AT-SPI via DBus on Unix/X11 and is tested to be working on Gnome and KDE. Are you sure that i3wm even supports accessibility?
  • QML Issues

    Unsolved
    3
    0 Votes
    3 Posts
    595 Views
    C
    @sierdzio This issue is currently being resolved. Thanks
  • qthread to const qthread *

    Solved
    7
    0 Votes
    7 Posts
    2k Views
    VRoninV
    And re-run qmake
  • EllipseShape in QML

    Unsolved
    9
    0 Votes
    9 Posts
    2k Views
    C
    @J.Hilk Hi there, With EllipseShape, it will not show a window when I release it. If I run the snippet from this page: http://doc.qt.io/qt-5/qml-qtquick-pathcubic.html It will run and not show the cubic curve. If I run this: http://doc.qt.io/qt-5/qml-qtquick-pathcurve.html It will run and reproduce the same image that is shown in the doc. I didn't test all the curve tools, but this is my results with those two. I spoke with a mod and I get to explain this a little bit more with the Qt team later, so that they can look at it. Thanks for your response.
  • Main windows suddenly stops accepting certian keystrokes

    Unsolved
    16
    1 Votes
    16 Posts
    3k Views
    mrjjM
    Hi The triggered is just like a buttons cliked(). The signal that is emitted when its keys is being pressed. You can connect to any kind of slot like normally. So for a key driven app, i woul dmost like connect it to slots in mainwindow .
  • Asynchronous REST API calls using QNetworkAccessManager.

    Unsolved
    7
    0 Votes
    7 Posts
    4k Views
    R_ramR
    Hello developers, I have tried something with QNetworkAccessManager & QThreads. I had some problem with Qthreads my QThread::finished function have not been called even after i got my response. Implementation here: RESTClientController -> Assign jobs to Threads #include "RESTClientController.h" #include <QThread> RESTClientController::RESTClientController(QObject *parent) : QObject(parent) { } void RESTClientController::executeRESTRequests(RESTClient *client) { QThread *thread = new QThread(); client->moveToThread(thread); connect(thread, &QThread::finished, this, &RESTClientController::onThreadFinished); connect(thread, &QThread::started, client, &RESTClient::startSync); connect(thread, &QThread::finished, thread, &QThread::deleteLater); thread->start(); } void RESTClientController::onThreadFinished() { qDebug() << "THread done its job !!!!!"; } Class RESTClient -> Used to make Network request through Common AccessManager #include "RESTClient.h" #include <QEventLoop> RESTClient::RESTClient(NetworkRequest *reqRes, QObject *parent) : QObject(parent), m_request(reqRes) { m_networkManager = new QNetworkAccessManager(); connect(m_networkManager, &QNetworkAccessManager::finished, m_request, &NetworkRequest::onFinished); } void RESTClient::startSync() { m_networkManager->get(m_request->constructRequest()); } Class NetworkRequest -> Container having QNetworkRequest & QNetworkReply #include "NetworkRequest.h" #include <QDebug> #include <QJsonDocument> NetworkRequest::NetworkRequest(QObject *parent) : QObject(parent) { initMembers(); } void NetworkRequest::initMembers() { m_request.setHeader(QNetworkRequest::ContentTypeHeader, "application/x-www-form-urlencoded"); } void NetworkRequest::setUrl(const QString hostName) { m_url = hostName; m_request.setUrl(QUrl(m_url)); } void NetworkRequest::setHeader(QNetworkRequest::KnownHeaders header, const QVariant &value) { m_request.setHeader(header, value); } void NetworkRequest::onFinished(QNetworkReply *reply) { int status = reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt(); QByteArray data = reply->readAll(); handleReply(status, data); } void NetworkRequest::handleReply(int status, QByteArray data) { QJsonDocument jsonDocument; QJsonParseError parsingResult; if (status >= 200 && status < 300) { // success jsonDocument = QJsonDocument::fromJson(data, &parsingResult); qDebug() << QString("Status: %1 !!! success").arg(QString::number(status)); } else if (status >= 300 && status < 400) { qDebug() << QString("Status: %1 !!! Redirected").arg(QString::number(status)); } else if (status >= 400 && status < 500) { qDebug() << QString("Status: %1 !!! Client error").arg(QString::number(status)); } else if (status >= 500 && status < 600) { qDebug() << QString("Status: %1 !!! Server error").arg(QString::number(status)); } else { qDebug() << QString("Status: %1 !!! Unknown error").arg(QString::number(status)); } } Main or Some Backend class -> Trigger requests RESTClientController *m_restController; NetworkRequest *request = new NetworkRequest(); RESTClient *restClient = new RESTClient(request); m_restController->executeRESTRequests(restClient); Above is my implementation as of now im jus creating QTHread instances. In future i had an idea to go with QThreadPool. But now I can't able to catch my finished signal from QThread. So that i can able to clear my instances. Thanks in advance
  • error read with useing QSettings

    Solved
    6
    0 Votes
    6 Posts
    2k Views
    M
    @joeQ my file is utf-8 format, this way not works
  • How to check the available free space of a selected drive in Qt?

    Unsolved
    5
    0 Votes
    5 Posts
    4k Views
    vishnuV
    @raven-worx you're correct. I have changed the constructor. Now it works.
  • Listing with custom widget

    Unsolved
    6
    0 Votes
    6 Posts
    2k Views
    mrjjM
    @yugosonegi Ok, should not be that much extra code to draw. Note that the sample only draws the things. To make it active, like the button, you must also implement editing feature that shows a real button so its clickable, This sampel show an active one http://doc.qt.io/qt-5/qtwidgets-itemviews-stardelegate-example.html The QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const override; is key here. It will allow you to create a real button/widget and not a picture of it for the current /selected item/row and hence you can click it etc.
  • QT application window not shown when started directly with xinit as non-root user

    Unsolved
    1
    0 Votes
    1 Posts
    391 Views
    No one has replied
  • QWebView fails to load Flickr authorization page

    Unsolved
    1
    0 Votes
    1 Posts
    289 Views
    No one has replied
  • Orthographic Surface3D: Move ValueAxis3D Labels to left-hand side?

    Unsolved
    2
    0 Votes
    2 Posts
    452 Views
    StevenFSS
    Z-Axis labels workaround - Displaying labels on the right in orthographic mode is a hard-coded default. Has anyone looked at this code before or have a QT-Core patch for this? A workaround is to set: scene.activeCamera.xRotation: 0.01; If anyone has more information please post, I may have to extend this core QT Data Visualization code myself. Cheers,