@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.
@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.
@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]

[image: fa9ba972-ee69-4d40-b61b-15d28d6bdd7d.PNG]
I set up everything using the Qt installer.
@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.
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);
}
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!
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 ??
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.
@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.
@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;
@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.
@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.
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