I want to develop some widgets for my project, I read Qt's widget source code & have some questions in programming:
1. The constructor of QAbstractButton:
explicit QAbstractButton (QWidget *parent = 0)
To copy to clipboard, switch view to plain text mode
What is the purpose and the meaning to using the keyword explicit in constructor?
2. In the function QToolButtonPrivate:opupTimerDone(), some commands I don't understand:
QPointer<QMenu> actualMenu; //the type of actualMenu is'n a pointer
...
if (...)
actualMenu = menuAction->menu();
else
actualMenu
= new QMenu(q
);
//but in this code, it used as a pointer
QPointer<QMenu> actualMenu; //the type of actualMenu is'n a pointer
...
if (...)
actualMenu = menuAction->menu();
else
actualMenu = new QMenu(q); //but in this code, it used as a pointer
To copy to clipboard, switch view to plain text mode
3. The relationship between QToolButton & QToolButtonPrivate (similar for other classes).
4. Using macro:
#define QTTR_NOOP(x) [B](x)[/B] // this macro has the result
#define Q_DOC_PROPERTY(text) // but this macro doesn't have the result
#define QTTR_NOOP(x) [B](x)[/B] // this macro has the result
#define Q_DOC_PROPERTY(text) // but this macro doesn't have the result
To copy to clipboard, switch view to plain text mode
#define Q_D(Class) Class##Private *const d=d_func()
#define Q_Q(Class) Class *const q=q_func()
#define Q_D(Class) Class##Private *const d=d_func()
#define Q_Q(Class) Class *const q=q_func()
To copy to clipboard, switch view to plain text mode
I don't understand the declare of these macros. Please explain it.
Thanks alot.
Bookmarks