Skip to content

General and Desktop

This is where all the desktop OS and general Qt questions belong.
83.3k Topics 455.9k Posts
  • 0 Votes
    45 Posts
    6k Views
    @KroMignon YEs I have done its working in the application ... @KroMignon [image: Screenshot-from-2019-12-12-16-19-59.png]
  • Need help with signals and slots

    Solved 12 Dec 2019, 09:57
    0 Votes
    4 Posts
    227 Views
    @sierdzio, @VRonin Thank you very much. I dont know why I put that if clause there in the beginning anymore. But actually it doesn't make any sense.... I didn't even look at the if clause while looking for the error... I tried the code without the if clause and it worked. Thank you very much for your help. I will try using qDebug() next time and I will take a look at the Qt Graphics Framework. I don't know it, to be honest.
  • This topic is deleted!

    Moved Unsolved 12 Dec 2019, 10:15
    0 Votes
    1 Posts
    7 Views
    No one has replied
  • I'm lost with signals and slots

    Unsolved 12 Dec 2019, 07:15
    0 Votes
    5 Posts
    377 Views
    Thank you.
  • Error codesigning frameworks on Xcode

    Unsolved 18 Sept 2019, 15:03
    0 Votes
    16 Posts
    2k Views
    @Kerndog73 I agree completely. The frameworks that Qt builds and distributes are non-standard and Xcode just can't deal with them. Modifying them doesn't work either, as you can see from my OP. I think they just need to be built differently. After much trial and error, I gave up and tried macdeployqt and it seemed to do what was necessary. Definitely would like to see Qt move towards using standard frameworks.
  • Unrecognized Command Error

    Unsolved 1 Dec 2019, 21:31
    0 Votes
    4 Posts
    957 Views
    @jsulm I keep having the same problem. I have Qt Creator 4.10.2 Qt 5.13.2. (MSVC 2017, 32 bit) From revision 7c61e936ce. My kits: [image: e630c895-0b76-47d2-90b4-e74565847ad4.PNG] ![2.PNG](https://ddgobkiprc33d.cloudfront.net/ceacb52d-0c1a-48 57-be83-f556ad03ac9b.PNG) [image: fa9ba972-ee69-4d40-b61b-15d28d6bdd7d.PNG] I set up everything using the Qt installer.
  • QProcess: Not reading ONLY std::cerr

    Solved 11 Dec 2019, 17:33
    0 Votes
    3 Posts
    482 Views
    @fem_dev I found my error: &QProcess::readyReadStandardError
  • 0 Votes
    6 Posts
    1k Views
    @RekTekk249 said in Importing libraries and including them still gives undefined references: Also, I heard of Qt::mkdir, but apparently it's doesn't have good performances micro-optimization - you call it once... it's just not worth the trouble.
  • QPlainTextEdit with equal line heights

    Solved 29 Nov 2019, 10:46
    1 Votes
    3 Posts
    2k Views
    Ok, I finally found the solution. The issue was the use of QPlaintTextEdit::fontMetrics() method. It provides only the integer data QFontMetrics of the font and rounds values below .5 to the floor. To solve this an instance of QFontMetricsF is needed. Additionally for some fonts the lineSpacing is smaller than calculating the bounding QRectF of the string "Äg". So my solution is: int TextViewEdit::lineCount() { QFontMetricsF metric(font()); qreal lineHeight = qCeil(qMax(metric.lineSpacing(), metric.boundingRect("Äg").height())); return qFloor(qreal(viewport()->height()) / lineHeight); }
  • 0 Votes
    1 Posts
    289 Views
    No one has replied
  • Memory leaks from QTableView + QStandardItemModel

    Unsolved 9 Dec 2019, 12:51
    0 Votes
    7 Posts
    847 Views
    One middle way between efficiency and ease of use is something like this: https://pastebin.com/XrppLZ3m
  • Send QJsonObject from plugin to main app

    Solved 10 Dec 2019, 14:04
    0 Votes
    10 Posts
    351 Views
    Thank you @SGaist and @jsulm With your help I think that I found a solution! Here is the code: My plugin interface is called Plugin_API. So the plugin_api.h is: #ifndef PLUGIN_API_H #define PLUGIN_API_H #include <QString> #include <QDebug> #include <QJsonObject> #include <QObject> // You have to import and inherit QOBject in the plugin interface class Plugin_API : public QObject { // USE Q_OBJECT MACRO inside the interface Q_OBJECT public: virtual ~Plugin_API() = default; virtual QJsonObject get_data(void) = 0; virtual void set_project_path(const QString project_path) = 0; virtual void open_ui(const QJsonObject ui_data) = 0; virtual void run(const int job_id) = 0; // ===== SIGNALS ===== // // You have to declare the signals in the interface too: virtual void send_msg(const QString msg) = 0; }; // Declare our interface: Q_DECLARE_INTERFACE(Plugin_API, "com.lamar.plugin") #endif // PLUGIN_API_H After that, in the plugin.h I have: // Do NOT inherit plublic QObject here: class PLUGINSHARED_EXPORT Plugin: public Plugin_API { // ADD Q_OBJECT MACRO HERE TOO: Q_OBJECT Q_PLUGIN_METADATA(IID "com.lamar.plugin") Q_INTERFACES(Plugin_API) ... // Overide the signal method: signals: void send_msg(const QString msg) override; In my Main Application header main.h I have: public slots: void receive_msg(const QString msg); And finally, the implementaion of the main application slot is: void main_app::receive_msg(const QString msg) { qDebug() << "I RECEIVE THIS MSG: " << msg; } Thank you @SGaist and @jsulm for your help and patience!
  • how to compile multi-plugin project

    Unsolved 11 Dec 2019, 08:51
    0 Votes
    2 Posts
    162 Views
    Hi In what way link them together? You mean you have 2 projects open and you want it to build as one or what does ", meaning that the folder just compile seperately" mean ? what folder ??
  • Get screen of your app

    Unsolved 9 Dec 2019, 15:46
    0 Votes
    3 Posts
    2k Views
    QScreen* p_screen = QApplication::screens().at(0); //Returns the "main" screen Edit: Ah, sorry. This will NOT return the screen that your main window is located on, only what Windows considers your main display.
  • set up mqtt for android_armv7

    Solved 11 Dec 2019, 13:35
    0 Votes
    3 Posts
    509 Views
    @Mandeep-Chaudhary said in set up mqtt for android_armv7: You need to set the ANDROID_NDK_ROOT environment variable to point to your Android NDK Did you do this? You need to install Android NDK to be able to build C++ applications for Android.
  • Make a sequence of QWidget moves

    Solved 11 Dec 2019, 02:21
    0 Votes
    5 Posts
    259 Views
    @jsulm Ok, i understand. Thank you for explanation!
  • Activating a Ui within an object

    Unsolved 11 Dec 2019, 10:18
    0 Votes
    2 Posts
    135 Views
    @willemf said in Activating a Ui within an object: //namespace Ui { // class DivelistGPS; //}; " it errors due to a forward declaration" - because ui is not a pointer! Forward declaration only works for pointers, if it is not a pointer compiler needs to know what DivelistGPS exactly is (you would need to include the header file). So change to: Ui::DivelistGPS *ui;
  • A custom push button based widget

    Unsolved 10 Dec 2019, 15:45
    0 Votes
    5 Posts
    437 Views
    @viniltc said in A custom push button based widget: which needs to be slightly different for promoted widgets Why do you have slots in these buttonts? Buttons usually emit signals and the receivers decide what to do with these signals.
  • Pass signal to a function and emit it

    Unsolved 11 Dec 2019, 09:42
    0 Votes
    5 Posts
    2k Views
    @VRonin , @federico-massimi I like @VRonin's template-based definition above. In addition, if I understand rightly(?), his use of (this->*my_signal)(value) means that your slot can still access QObject::sender(), which can be useful.
  • Qt TcpMultiThread Server

    Unsolved 10 Dec 2019, 14:09
    0 Votes
    3 Posts
    237 Views
    I see a number of potential things going wrong here. Let's start with the most obvious one, what is ClientList? who owns it? As a separate but important point. Why are you using multithreading to manage TCP socket? if it's to allow multiple connections it's a misconception born from the fortune client/server example being not very clear. You can check out this example for an hopefully clearer explanation