Home > Mobile >  Rookie help label output
Rookie help label output

Time:09-16

How to put the Qdebug data sent to the console output to the label2, let label2 print out the data, help

CodePudding user response:

Qdebug direct send the data to the console, do not know how to send the label2 output

CodePudding user response:

That you don't use qdebug, direct call label the settext method of

CodePudding user response:

Under the mouse events directly UI - & gt; Label_2 - & gt; SetText ("... ");

CodePudding user response:

The
reference 3 floor scribbler response:
under the mouse events directly UI - & gt; Label_2 - & gt; SetText ("... ");
settext inside concrete should write what

CodePudding user response:

The main function add:
QInstallMessageHandler (customMessageHandler);


His window to write a function:
Void YourWidget: : setLabelText (QString text) {
Your_label - & gt; SetText (text);
}

The main. CPP write this:

Bool isInit=false;//your window after the completion of the set to true it

# if QT_VERSION & gt;=QT_VERSION_CHECK (5, 0, 0)
Void customMessageHandler (QtMsgType type, const QMessageLogContext & amp; The const QString & amp; STR)
{
QString TXT=STR;
# the else
Void customMessageHandler (QtMsgType type, const char * MSG)
{
QString TXT (MSG);
# endif
Q_UNUSED (type);

//ToDo: here to send your own global signals or call interface
//emit your_global_object. Your_signal (TXT);
If (isInit)
{
You_widget. SetLabelText (TXT);
}
}
  •  Tags:  
  • Qt
  • Related