QPointerEvent throws error
-
@curiosity And why don't you do what I told you then? When you want to use a library then you have to link against this library...
-
@curiosity And why don't you do what I told you then? When you want to use a library then you have to link against this library...
this is my .pro file
QT += gui // I guess this is how you suggested
QT += widgets-lQtGui
HEADERS = knob.h
SOURCES = main.cpp knob.cppinstall
target.path = $$[QT_INSTALL_EXAMPLES]/widgets/touch/knobs
INSTALLS += targetthis didnt work
-
this is my .pro file
QT += gui // I guess this is how you suggested
QT += widgets-lQtGui
HEADERS = knob.h
SOURCES = main.cpp knob.cppinstall
target.path = $$[QT_INSTALL_EXAMPLES]/widgets/touch/knobs
INSTALLS += targetthis didnt work
-
-
@curiosity But what is it doing as you show in the middle of your
.pro
file? It will likely make it incorrect. -
@curiosity First: this linker flag is not needed. Second: the way you added it is wrong and makes no sense.
-
@curiosity But what is it doing as you show in the middle of your
.pro
file? It will likely make it incorrect.I removed it. also #include <QApplication> is not resolved by the compiler. i have to include the entire path/absolute path something like this
#include <C:\Qt\Qt5.12.12\5.12.12\winrt_x64_msvc2017\include\QtWidgets\QApplication> which is not the right way
-
I removed it. also #include <QApplication> is not resolved by the compiler. i have to include the entire path/absolute path something like this
#include <C:\Qt\Qt5.12.12\5.12.12\winrt_x64_msvc2017\include\QtWidgets\QApplication> which is not the right way
@curiosity said in QPointerEvent throws error:
also #include <QApplication> is not resolved by the compiler
Then something is wrong with your project configuration.
Did you rerun qmake after editing the pro file?
It also looks like you're using Visual Studio - I never used it with Qt, but maybe you need to recreate project files after changing pro file? -
@curiosity said in QPointerEvent throws error:
also #include <QApplication> is not resolved by the compiler
Then something is wrong with your project configuration.
Did you rerun qmake after editing the pro file?
It also looks like you're using Visual Studio - I never used it with Qt, but maybe you need to recreate project files after changing pro file? -
@curiosity First: this linker flag is not needed. Second: the way you added it is wrong and makes no sense.
-
@curiosity
Start by showing definition of the two slot functions you use.
Is this an error only in the code completion inside Qt Creator, or do you get these errors when you actually compile? -
@curiosity You probably need to tell the compiler which overload you want to connect, see https://wiki.qt.io/New_Signal_Slot_Syntax#Overload
-
@curiosity
Start by showing definition of the two slot functions you use.
Is this an error only in the code completion inside Qt Creator, or do you get these errors when you actually compile? -
@curiosity Well, then compile.
Code model can produce false errors in QtCreator. -
@curiosity Well, then compile.
Code model can produce false errors in QtCreator. -
i am trying to print the edited text(values entered by the user) onto the console. but still getting this error
SIGNAL(&QLineEdit::textEdited)
really?
You should read the Qt signals and slot documentation and also re-read the wiki page which @jsulm already pointed you to.
-
SIGNAL(&QLineEdit::textEdited)
really?
You should read the Qt signals and slot documentation and also re-read the wiki page which @jsulm already pointed you to.
connect(echoComboBox, &QComboBox::editTextChanged(echoLineEdit), this, [=](const QString &edited){qDebug() << edited;});
i made the above change. but signal is giving error
"call to non static function without an object argument". editTextChanged has qstring . i tried with qsting and qlineEdit as arg. its giving same error with both -
connect(echoComboBox, &QComboBox::editTextChanged(echoLineEdit), this, [=](const QString &edited){qDebug() << edited;});
i made the above change. but signal is giving error
"call to non static function without an object argument". editTextChanged has qstring . i tried with qsting and qlineEdit as arg. its giving same error with both@curiosity Please read the documentation! What you're doing is simply wrong and not even valid C++!
You do not pass parameters when calling connect! Parameters are passed to the signal when it is emitted and then from the signal to slot.connect(echoComboBox, &QComboBox::editTextChanged, this, [=](const QString &edited){qDebug() << edited;});
-
@curiosity Please read the documentation! What you're doing is simply wrong and not even valid C++!
You do not pass parameters when calling connect! Parameters are passed to the signal when it is emitted and then from the signal to slot.connect(echoComboBox, &QComboBox::editTextChanged, this, [=](const QString &edited){qDebug() << edited;});
thanks for correcting.
i am trying to echo the text entered by the user into QCombobox in the next line.
connect(echoComboBox, &QComboBox::currentTextChanged,this, &Window::onCurrentTextChanged);
auto text = echoComboBox->currentText(); passwordLineEdit = new QLineEdit; passwordLineEdit->setPlaceholderText("Password entered is : "); //But this line is displayed in a new window. and password is not echoed.
passwordLineEdit->show();
echoComboBox->show();
-
thanks for correcting.
i am trying to echo the text entered by the user into QCombobox in the next line.
connect(echoComboBox, &QComboBox::currentTextChanged,this, &Window::onCurrentTextChanged);
auto text = echoComboBox->currentText(); passwordLineEdit = new QLineEdit; passwordLineEdit->setPlaceholderText("Password entered is : "); //But this line is displayed in a new window. and password is not echoed.
passwordLineEdit->show();
echoComboBox->show();
@curiosity said in QPointerEvent throws error:
//But this line is displayed in a new window
You have created a
new QLineEdit
but not put it anywhere (e.g. on an existing window), so where do you expect it to go? I do not know why you are choosing to create a newQLineEdit
dynamically, but give it a parent and/or place it on some widget's layout.I really don't know what you are doing with a combobox."i am trying to echo the text entered by the user into QCombobox" --- what text is being entered how by user into combobox. Why in the world would you have a combobox, to choose an existing item from, if you want a user to enter a line of text for a password?
passwordLineEdit->setPlaceholderText("Password entered is : "); //But this line is displayed in a new window. and password is not echoed.
"Password is not echoed", what do you mean or expect? All you have done here is set the placeholder text of a
QLineEdit
to a fixed string. I see nothing in your code which perhaps copes/displays theauto text = echoComboBox->currentText();
anywhere.@jsulm gave you sample code for picking up changed edited text. All you have to do is change his lambda slot to (preferably using his signal) to call a method of you own, like you show with
&Window::onCurrentTextChanged
, and write the code in that to access the current text or thetext
parameter sent from void QComboBox::editTextChanged(const QString &text) signal.