Home > Mobile >  How to use the signal to open another QWiget class is a base class
How to use the signal to open another QWiget class is a base class

Time:12-06

# # ifndef QCOL_H
# define QCOL_H

# include & lt; QWidget>
# include & lt; QPainter>
# include & lt; QMouseEvent>
# include & lt; Math. H>
# include & lt; QMainWindow>

The class QCol: public QWidget
{
Q_OBJECT

Public:
QCol (QWidget * parent=0);
QSize minimumSizeHint () const;
QSize sizeHint () const;
~ QCol ();

Signals:
Void colorChanged (QColor);

Public slots:

Protected:
Void paintEvent (QPaintEvent *);
Void mousePressEvent (QMouseEvent *);
Void mouseMoveEvent (QMouseEvent *);
Void paintBorder ();
Void paintBar ();
Void paintValue ();
Void paintText ();

Private:
Double redY.
Double greenY.
Double blueY;
Double opY;
Double redyp;
Double greenyp;
Double blueyp;
Double opyp;

};
This is the header file, it is an RGB, I want to use another kind of signaling opened his, how to do ah
# endif//QCOL_H

CodePudding user response:

The connect signal, write this - in the groove function & gt; show();

CodePudding user response:

If QCol is global, you can directly call QCol open QCol static method, need not use signal channel,

CodePudding user response:

In the base class to write emit
Write the connect in QCol class

CodePudding user response:

reference 1st floor qiushot response:
connect signals, write this - in the groove function & gt; show();

Show () itself is not a slot function,,,

CodePudding user response:

Main functions include the header file, and then directly constructed in time of need not to go?
  •  Tags:  
  • Qt
  • Related