mirror of
https://bitbucket.org/smil3y/katie.git
synced 2025-02-27 04:13:08 +00:00
318 lines
11 KiB
Groff
318 lines
11 KiB
Groff
.\" Automatically generated by Pod::Man 2.28 (Pod::Simple 3.29)
|
|
.\"
|
|
.\" Standard preamble:
|
|
.\" ========================================================================
|
|
.de Sp \" Vertical space (when we can't use .PP)
|
|
.if t .sp .5v
|
|
.if n .sp
|
|
..
|
|
.de Vb \" Begin verbatim text
|
|
.ft CW
|
|
.nf
|
|
.ne \\$1
|
|
..
|
|
.de Ve \" End verbatim text
|
|
.ft R
|
|
.fi
|
|
..
|
|
.\" Set up some character translations and predefined strings. \*(-- will
|
|
.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
|
|
.\" double quote, and \*(R" will give a right double quote. \*(C+ will
|
|
.\" give a nicer C++. Capital omega is used to do unbreakable dashes and
|
|
.\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff,
|
|
.\" nothing in troff, for use with C<>.
|
|
.tr \(*W-
|
|
.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
|
|
.ie n \{\
|
|
. ds -- \(*W-
|
|
. ds PI pi
|
|
. if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
|
|
. if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch
|
|
. ds L" ""
|
|
. ds R" ""
|
|
. ds C` ""
|
|
. ds C' ""
|
|
'br\}
|
|
.el\{\
|
|
. ds -- \|\(em\|
|
|
. ds PI \(*p
|
|
. ds L" ``
|
|
. ds R" ''
|
|
. ds C`
|
|
. ds C'
|
|
'br\}
|
|
.\"
|
|
.\" Escape single quotes in literal strings from groff's Unicode transform.
|
|
.ie \n(.g .ds Aq \(aq
|
|
.el .ds Aq '
|
|
.\"
|
|
.\" If the F register is turned on, we'll generate index entries on stderr for
|
|
.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
|
|
.\" entries marked with X<> in POD. Of course, you'll have to process the
|
|
.\" output yourself in some meaningful fashion.
|
|
.\"
|
|
.\" Avoid warning from groff about undefined register 'F'.
|
|
.de IX
|
|
..
|
|
.nr rF 0
|
|
.if \n(.g .if rF .nr rF 1
|
|
.if (\n(rF:(\n(.g==0)) \{
|
|
. if \nF \{
|
|
. de IX
|
|
. tm Index:\\$1\t\\n%\t"\\$2"
|
|
..
|
|
. if !\nF==2 \{
|
|
. nr % 0
|
|
. nr F 2
|
|
. \}
|
|
. \}
|
|
.\}
|
|
.rr rF
|
|
.\" ========================================================================
|
|
.\"
|
|
.IX Title "MOC 1"
|
|
.TH MOC 1 "2016-08-01" "Katie 4.9.0" "Katie Manual"
|
|
.\" For nroff, turn off justification. Always turn off hyphenation; it makes
|
|
.\" way too many mistakes in technical documents.
|
|
.if n .ad l
|
|
.nh
|
|
.SH "NAME"
|
|
moc \- Qt meta object support code generator
|
|
.SH "SYNOPSIS"
|
|
.IX Header "SYNOPSIS"
|
|
moc [options] <source\-file|header\-file> [<source\-file|header\-file>] ...
|
|
.SH "DESCRIPTION"
|
|
.IX Header "DESCRIPTION"
|
|
moc reads one or more \*(C+ class declarations from a \*(C+ header or source file
|
|
and generates one \*(C+ source file containing meta object information for the
|
|
classes. The \*(C+ source file generated by the moc must be compiled and linked
|
|
with the implementation of the class (or it can be #included into the class's
|
|
source file).
|
|
.SH "OPTIONS"
|
|
.IX Header "OPTIONS"
|
|
.Vb 1
|
|
\& \-o<file> write output to file rather than stdout
|
|
\&
|
|
\& \-I<dir> add dir to the include path for header files
|
|
\&
|
|
\& \-E preprocess only; do not generate meta object code
|
|
\&
|
|
\& \-D<macro>[=<def>] define macro, with optional definition
|
|
\&
|
|
\& \-U<macro> undefine macro
|
|
\&
|
|
\& \-i do not generate an #include statement
|
|
\&
|
|
\& \-p<path> path prefix for included file
|
|
\&
|
|
\& \-f[<file>] force #include, optional file name
|
|
\&
|
|
\& \-nn do not display notes
|
|
\&
|
|
\& \-nw do not display warnings
|
|
\&
|
|
\& @<file> read additional options from file
|
|
\&
|
|
\& \-v display version of moc
|
|
.Ve
|
|
.SH "EXIT STATUS"
|
|
.IX Header "EXIT STATUS"
|
|
moc returns 0 on success and other on unexcepted failure.
|
|
.SH "BUGS"
|
|
.IX Header "BUGS"
|
|
.Vb 3
|
|
\& The moc does not expand #include or #define, it simply skips any
|
|
\& preprocessor directives it encounters. This is regrettable, but is normally
|
|
\& not a problem in practice.
|
|
\&
|
|
\& The moc does not handle all of C++. The main problem is that class
|
|
\& templates cannot have signals or slots. This is an important bug. Here is
|
|
\& an example:
|
|
\&
|
|
\& class SomeTemplate<int> : public QFrame {
|
|
\& Q_OBJECT
|
|
\& ....
|
|
\& signals:
|
|
\& void bugInMocDetected( int );
|
|
\& };
|
|
\&
|
|
\& Less importantly, the following constructs are illegal. All of them have
|
|
\& have alternatives which we think are usually better, so removing these
|
|
\& limitations is not a high priority for us.
|
|
.Ve
|
|
.SS "Multiple inheritance requires QObject to be first."
|
|
.IX Subsection "Multiple inheritance requires QObject to be first."
|
|
.Vb 3
|
|
\& If you are using multiple inheritance, moc assumes that the first inherited
|
|
\& class is a subclass of QObject. Also, be sure that only the first inherited
|
|
\& class is a QObject.
|
|
\&
|
|
\& class SomeClass : public QObject, public OtherClass {
|
|
\& ...
|
|
\& };
|
|
\&
|
|
\& This bug is almost impossible to fix; since the moc does not expand #include
|
|
\& or #define, it cannot find out which one of the base classes is a QObject.
|
|
.Ve
|
|
.SS "Function pointers cannot be arguments to signals or slots."
|
|
.IX Subsection "Function pointers cannot be arguments to signals or slots."
|
|
.Vb 2
|
|
\& In most cases where you would consider that, we think inheritance is a
|
|
\& better alternative. Here is an example of illegal syntax:
|
|
\&
|
|
\& class SomeClass : public QObject {
|
|
\& Q_OBJECT
|
|
\& ...
|
|
\& public slots:
|
|
\& // illegal
|
|
\& void apply( void (*apply)(List *, void *), void * );
|
|
\& };
|
|
\&
|
|
\& You can work around this restriction like this:
|
|
\&
|
|
\& typedef void (*ApplyFunctionType)( List *, void * );
|
|
\&
|
|
\& class SomeClass : public QObject {
|
|
\& Q_OBJECT
|
|
\& ...
|
|
\& public slots:
|
|
\& void apply( ApplyFunctionType, char * );
|
|
\& };
|
|
\&
|
|
\& It may sometimes be even better to replace the function pointer with
|
|
\& inheritance and virtual functions, signals or slots.
|
|
.Ve
|
|
.SS "Friend declarations cannot be placed in signals or slots sections"
|
|
.IX Subsection "Friend declarations cannot be placed in signals or slots sections"
|
|
.Vb 3
|
|
\& Sometimes it will work, but in general, friend declarations cannot be placed
|
|
\& in signals or slots sections. Put them in the good old private, protected
|
|
\& or public sections instead. Here is an example of the illegal syntax:
|
|
\&
|
|
\& class SomeClass : public QObject {
|
|
\& Q_OBJECT
|
|
\& ...
|
|
\& signals:
|
|
\& friend class ClassTemplate<char>; // illegal
|
|
\& };
|
|
.Ve
|
|
.SS "Signals and slots cannot be upgraded"
|
|
.IX Subsection "Signals and slots cannot be upgraded"
|
|
.Vb 2
|
|
\& The C++ feature of upgrading an inherited member function to public status
|
|
\& is not extended to cover signals and slots. Here is an illegal example:
|
|
\&
|
|
\& class Whatever : public QButtonGroup {
|
|
\& ...
|
|
\& public slots:
|
|
\& QButtonGroup::buttonPressed; // illegal
|
|
\& ...
|
|
\& };
|
|
\&
|
|
\& The QButtonGroup::buttonPressed() slot is protected.
|
|
\&
|
|
\& C++ quiz: What happens if you try to upgrade a protected member function
|
|
\& which is overloaded?
|
|
\&
|
|
\& \- All the functions are upgraded.
|
|
\&
|
|
\& \- That is not legal C++.
|
|
.Ve
|
|
.SS "Type macros cannot be used for signal and slot arguments"
|
|
.IX Subsection "Type macros cannot be used for signal and slot arguments"
|
|
.Vb 2
|
|
\& Since the moc does not expand #define, type macros that take an argument
|
|
\& will not work in signals and slots. Here is an illegal example:
|
|
\&
|
|
\& #ifdef ultrix
|
|
\& #define SIGNEDNESS(a) unsigned a
|
|
\& #else
|
|
\& #define SIGNEDNESS(a) a
|
|
\& #endif
|
|
\& class Whatever : public QObject {
|
|
\& ...
|
|
\& signals:
|
|
\& void someSignal( SIGNEDNESS(int) ); // illegal
|
|
\& };
|
|
\&
|
|
\& A #define without arguments works.
|
|
.Ve
|
|
.SS "Nested classes cannot be in the signals or slots sections nor have signals or slots"
|
|
.IX Subsection "Nested classes cannot be in the signals or slots sections nor have signals or slots"
|
|
.Vb 1
|
|
\& Here\*(Aqs an example:
|
|
\&
|
|
\& class A {
|
|
\& Q_OBJECT
|
|
\& public:
|
|
\& class B {
|
|
\& public slots: // illegal
|
|
\& void b();
|
|
\& ...
|
|
\& };
|
|
\& signals:
|
|
\& class B { // illegal
|
|
\& void b();
|
|
\& ...
|
|
\& }:
|
|
\& };
|
|
.Ve
|
|
.SS "Constructors cannot be used in signals or slots sections"
|
|
.IX Subsection "Constructors cannot be used in signals or slots sections"
|
|
.Vb 4
|
|
\& It is a mystery to us why anyone would put a constructor on either the
|
|
\& signals or slots sections. You can\*(Aqt, anyway (except that it happens to
|
|
\& work in some cases). Put them in private, protected or public sections,
|
|
\& where they belong. Here is an example of the illegal syntax:
|
|
\&
|
|
\& class SomeClass : public QObject {
|
|
\& Q_OBJECT
|
|
\& public slots:
|
|
\& SomeClass( QObject *parent, const char *name )
|
|
\& : QObject( parent, name ) {} // illegal
|
|
\& ...
|
|
\& };
|
|
.Ve
|
|
.SS "Properties need to be declared before the public section that contains the respective get and set functions"
|
|
.IX Subsection "Properties need to be declared before the public section that contains the respective get and set functions"
|
|
.Vb 4
|
|
\& Declaring the first property within or after the public section that
|
|
\& contains the type definition and the respective get and set functions does
|
|
\& not work as expected. The moc will complain that it can neither find the
|
|
\& functions nor resolve the type. Here is an example of the illegal syntax:
|
|
\&
|
|
\& class SomeClass : public QObject {
|
|
\& Q_OBJECT
|
|
\& public:
|
|
\& ...
|
|
\& // illegal
|
|
\& Q_PROPERTY( Priority priority READ priority WRITE setPriority )
|
|
\& Q_ENUMS( Priority )
|
|
\& enum Priority { High, Low, VeryHigh, VeryLow };
|
|
\& void setPriority( Priority );
|
|
\& Priority priority() const;
|
|
\& ...
|
|
\& };
|
|
\&
|
|
\& Work around this limitation by declaring all properties at the beginning of
|
|
\& the class declaration, right after Q_OBJECT:
|
|
\&
|
|
\& class SomeClass : public QObject {
|
|
\& Q_OBJECT
|
|
\& Q_PROPERTY( Priority priority READ priority WRITE setPriority )
|
|
\& Q_ENUMS( Priority )
|
|
\& public:
|
|
\& ...
|
|
\& enum Priority { High, Low, VeryHigh, VeryLow };
|
|
\& void setPriority( Priority );
|
|
\& Priority priority() const;
|
|
\& ...
|
|
\& };
|
|
.Ve
|
|
.SH "AUTHORS"
|
|
.IX Header "AUTHORS"
|
|
The Qt Company Ltd.
|
|
.PP
|
|
Copyright (C) 2015 The Qt Company Ltd.
|
|
.PP
|
|
Licensed through \s-1GNU\s0 Lesser General Public License/GNU General Public License.
|