static void setCustomColor(int index, QRgb color);
static void setStandardColor(int index, QRgb color);
-#ifdef QT3_SUPPORT
- static QColor getColor(const QColor &init, QWidget *parent, const char *name)
- { Q_UNUSED(name); return getColor(init, parent); }
- static QRgb getRgba(QRgb rgba, bool *ok, QWidget *parent, const char *name)
- { Q_UNUSED(name); return getRgba(rgba, ok, parent); }
-#endif
Q_SIGNALS:
void currentColorChanged(const QColor &color);
#endif
}
-#ifdef QT3_SUPPORT
-/*!
- \overload
- \obsolete
-*/
-QDialog::QDialog(QWidget *parent, const char *name, bool modal, Qt::WindowFlags f)
- : QWidget(*new QDialogPrivate, parent,
- f
- | QFlag(modal ? Qt::WShowModal : Qt::WindowType(0))
- | QFlag((f & Qt::WindowType_Mask) == 0 ? Qt::Dialog : Qt::WindowType(0))
- )
-{
- setObjectName(QString::fromAscii(name));
-}
-#endif
/*!
\overload
public:
explicit QDialog(QWidget *parent = 0, Qt::WindowFlags f = 0);
-#ifdef QT3_SUPPORT
- QT3_SUPPORT_CONSTRUCTOR QDialog(QWidget *parent, const char *name, bool modal = false,
- Qt::WindowFlags f = 0);
-#endif
~QDialog();
enum DialogCode { Rejected, Accepted };
public Q_SLOTS:
void showMessage(const QString &message);
void showMessage(const QString &message, const QString &type);
-#ifdef QT3_SUPPORT
- inline QT_MOC_COMPAT void message(const QString &text) { showMessage(text); }
-#endif
protected:
void done(int);
#endif // QT_NO_COMPLETER
-#ifdef QT3_SUPPORT
-/*!
- Use selectedFiles() instead.
-
- \oldcode
- QString selected = dialog->selectedFile();
- \newcode
- QStringList files = dialog->selectedFiles();
- QString selected;
- if (!files.isEmpty())
- selected = files[0];
- \endcode
-*/
-QString QFileDialog::selectedFile() const
-{
- QStringList files = selectedFiles();
- return files.size() ? files.at(0) : QString();
-}
-
-/*!
- \typedef QFileDialog::Mode
-
- Use QFileDialog::FileMode instead.
-*/
-
-/*!
- \fn void QFileDialog::setMode(FileMode m)
-
- Use setFileMode() instead.
-*/
-
-/*!
- \fn FileMode QFileDialog::mode() const
-
- Use fileMode() instead.
-*/
-
-/*!
- \fn void QFileDialog::setDir(const QString &directory)
-
- Use setDirectory() instead.
-*/
-
-/*!
- \fn void QFileDialog::setDir( const QDir &directory )
-
- Use setDirectory() instead.
-*/
-
-/*!
- \fn QStringList QFileDialog::getOpenFileNames(const QString &filter,
- const QString &dir, QWidget *parent, const char* name,
- const QString &caption, QString *selectedFilter, bool resolveSymlinks)
-
- Use the getOpenFileNames() overload that takes \a parent as the first
- argument instead.
-*/
-
-/*!
- \fn QString QFileDialog::getOpenFileName(const QString &dir,
- const QString &filter, QWidget *parent = 0, const char *name,
- const QString &caption, QString *selectedFilter, bool resolveSymlinks)
-
- Use the getOpenFileName() overload that takes \a parent as the first
- argument instead.
-*/
-
-/*!
- \fn QString QFileDialog::getSaveFileName(const QString &dir,
- const QString &filter, QWidget *parent, const char *name,
- const QString &caption, QString *selectedFilter, bool resolveSymlinks)
-
- Use the getSaveFileName() overload that takes \a parent as the first
- argument instead.
-*/
-
-/*!
- \fn QString QFileDialog::getExistingDirectory(const QString &dir,
- QWidget *parent, const char *name, const QString &caption,
- bool dirOnly, bool resolveSymlinks)
-
- Use the getExistingDirectory() overload that takes \a parent as
- the first argument instead.
-*/
-
-#endif // QT3_SUPPORT
QT_END_NAMESPACE
void filterSelected(const QString &filter);
public:
-#ifdef QT3_SUPPORT
- typedef FileMode Mode;
- inline QT3_SUPPORT void setMode(FileMode m) { setFileMode(m); }
- inline QT3_SUPPORT FileMode mode() const { return fileMode(); }
- inline QT3_SUPPORT void setDir(const QString &directory) { setDirectory(directory); }
- inline QT3_SUPPORT void setDir( const QDir &directory ) { setDirectory(directory); }
- QT3_SUPPORT QString selectedFile() const;
-#endif
static QString getOpenFileName(QWidget *parent = 0,
const QString &caption = QString(),
QString *selectedFilter = 0,
Options options = 0);
-#ifdef QT3_SUPPORT
- inline static QString QT3_SUPPORT getOpenFileName(const QString &dir,
- const QString &filter = QString(),
- QWidget *parent = 0, const char* name = 0,
- const QString &caption = QString(),
- QString *selectedFilter = 0,
- bool resolveSymlinks = true)
- { Q_UNUSED(name);
- return getOpenFileName(parent, caption, dir, filter, selectedFilter,
- resolveSymlinks ? Option(0) : DontResolveSymlinks); }
-
- inline static QString QT3_SUPPORT getSaveFileName(const QString &dir,
- const QString &filter = QString(),
- QWidget *parent = 0, const char* name = 0,
- const QString &caption = QString(),
- QString *selectedFilter = 0,
- bool resolveSymlinks = true)
- { Q_UNUSED(name);
- return getSaveFileName(parent, caption, dir, filter, selectedFilter,
- resolveSymlinks ? Option(0) : DontResolveSymlinks); }
-
- inline static QString QT3_SUPPORT getExistingDirectory(const QString &dir,
- QWidget *parent = 0,
- const char* name = 0,
- const QString &caption = QString(),
- bool dirOnly = true,
- bool resolveSymlinks = true)
- { Q_UNUSED(name);
- return getExistingDirectory(parent, caption, dir,
- Options((resolveSymlinks ? Option(0) : DontResolveSymlinks)
- | (dirOnly ? ShowDirsOnly : Option(0)))); }
-
- inline static QStringList QT3_SUPPORT getOpenFileNames(const QString &filter,
- const QString &dir = QString(),
- QWidget *parent = 0,
- const char* name = 0,
- const QString &caption = QString(),
- QString *selectedFilter = 0,
- bool resolveSymlinks = true)
- { Q_UNUSED(name);
- return getOpenFileNames(parent, caption, dir, filter, selectedFilter,
- resolveSymlinks ? Option(0) : DontResolveSymlinks); }
-#endif // QT3_SUPPORT
protected:
QFileDialog(const QFileDialogArgs &args);
static QFont getFont(bool *ok, const QFont &initial, QWidget *parent = 0);
static QFont getFont(bool *ok, QWidget *parent = 0);
-#ifdef QT3_SUPPORT
- static QFont getFont(bool *ok, const QFont &initial, QWidget *parent, const char *name)
- { Q_UNUSED(name); return getFont(ok, initial, parent); }
- static QFont getFont(bool *ok, QWidget *parent, const char *name)
- { Q_UNUSED(name); return getFont(ok, parent); }
-#endif
Q_SIGNALS:
void currentFontChanged(const QFont &font);
int minValue = -2147483647, int maxValue = 2147483647,
int step = 1, bool *ok = 0, Qt::WindowFlags flags = 0);
-#ifdef QT3_SUPPORT
- inline static QT3_SUPPORT QString getText(const QString &title, const QString &label,
- QLineEdit::EchoMode echo = QLineEdit::Normal,
- const QString &text = QString(), bool *ok = 0,
- QWidget *parent = 0, const char * = 0, Qt::WindowFlags flags = 0)
- { return getText(parent, title, label, echo, text, ok, flags); }
- inline static QT3_SUPPORT int getInteger(const QString &title, const QString &label, int value = 0,
- int minValue = -2147483647, int maxValue = 2147483647,
- int step = 1, bool *ok = 0,
- QWidget *parent = 0, const char * = 0, Qt::WindowFlags flags = 0)
- { return getInteger(parent, title, label, value, minValue, maxValue, step, ok, flags); }
- inline static QT3_SUPPORT double getDouble(const QString &title, const QString &label, double value = 0,
- double minValue = -2147483647, double maxValue = 2147483647,
- int decimals = 1, bool *ok = 0,
- QWidget *parent = 0, const char * = 0, Qt::WindowFlags flags = 0)
- { return getDouble(parent, title, label, value, minValue, maxValue, decimals, ok, flags); }
- inline static QT3_SUPPORT QString getItem(const QString &title, const QString &label, const QStringList &list,
- int current = 0, bool editable = true, bool *ok = 0,
- QWidget *parent = 0, const char * = 0, Qt::WindowFlags flags = 0)
- { return getItem(parent, title, label, list, current, editable, ok, flags); }
-#endif
Q_SIGNALS:
// ### emit signals!
setDefaultButton(d_func()->defaultButton);
}
-#ifdef QT3_SUPPORT
-/*!
- \compat
-
- Constructs a message box with the given \a parent, \a name, and
- window flags, \a f.
- The window title is specified by \a title, and the message box
- displays message text and an icon specified by \a text and \a icon.
-
- The buttons that the user can access to respond to the message are
- defined by \a button0, \a button1, and \a button2.
-*/
-QMessageBox::QMessageBox(const QString& title,
- const QString &text, Icon icon,
- int button0, int button1, int button2,
- QWidget *parent, const char *name,
- bool modal, Qt::WindowFlags f)
- : QDialog(*new QMessageBoxPrivate, parent,
- f | Qt::WStyle_Customize | Qt::WStyle_DialogBorder | Qt::WStyle_Title | Qt::WStyle_SysMenu | Qt::WindowCloseButtonHint)
-{
- Q_D(QMessageBox);
- setObjectName(QString::fromAscii(name));
- d->init(title, text);
- d->addOldButtons(button0, button1, button2);
- setModal(modal);
- setIcon(icon);
-}
-
-/*!
- \compat
- Constructs a message box with the given \a parent and \a name.
-*/
-QMessageBox::QMessageBox(QWidget *parent, const char *name)
- : QDialog(*new QMessageBoxPrivate, parent,
- Qt::WStyle_Customize | Qt::WStyle_DialogBorder | Qt::WStyle_Title | Qt::WStyle_SysMenu | Qt::WindowCloseButtonHint)
-{
- Q_D(QMessageBox);
- setObjectName(QString::fromAscii(name));
- d->init();
-}
-
-/*!
- Returns the pixmap used for a standard icon. This
- allows the pixmaps to be used in more complex message boxes.
- \a icon specifies the required icon, e.g. QMessageBox::Information,
- QMessageBox::Warning or QMessageBox::Critical.
-
- \a style is unused.
-*/
-
-QPixmap QMessageBox::standardIcon(Icon icon, Qt::GUIStyle style)
-{
- Q_UNUSED(style);
- return QMessageBox::standardIcon(icon);
-}
-
-/*!
- \fn int QMessageBox::message(const QString &title, const QString &text,
- const QString &buttonText, QWidget *parent = 0,
- const char *name = 0)
-
- Opens a modal message box with the given \a title and showing the
- given \a text. The message box has a single button which has the
- given \a buttonText (or tr("OK")). The message box is centred over
- its \a parent and is called \a name.
-
- Use information(), warning(), question(), or critical() instead.
-
- \oldcode
- QMessageBox::message(tr("My App"), tr("All occurrences replaced."),
- tr("Close"), this);
- \newcode
- QMessageBox::information(this, tr("My App"),
- tr("All occurrences replaced."),
- QMessageBox::Close);
- \endcode
-*/
-
-/*!
- \fn bool QMessageBox::query(const QString &caption,
- const QString& text,
- const QString& yesButtonText,
- const QString& noButtonText,
- QWidget *parent, const char *name)
-
- \obsolete
-
- Queries the user using a modal message box with up to two buttons.
- The message box has the given \a caption (although some window
- managers don't show it), and shows the given \a text. The left
- button has the \a yesButtonText (or tr("OK")), and the right button
- has the \a noButtonText (or isn't shown). The message box is centred
- over its \a parent and is called \a name.
-
- Use information(), question(), warning(), or critical() instead.
-*/
-
-#endif
QPixmap QMessageBoxPrivate::standardIcon(QMessageBox::Icon icon, QMessageBox *mb)
{
void setWindowTitle(const QString &title);
void setWindowModality(Qt::WindowModality windowModality);
-#ifdef QT3_SUPPORT
- QT3_SUPPORT_CONSTRUCTOR QMessageBox(const QString &title, const QString &text, Icon icon,
- int button0, int button1, int button2,
- QWidget *parent, const char *name, bool modal,
- Qt::WindowFlags f = Qt::Dialog | Qt::MSWindowsFixedSizeDialogHint);
- QT3_SUPPORT_CONSTRUCTOR QMessageBox(QWidget *parent, const char *name);
-
- static QT3_SUPPORT QPixmap standardIcon(Icon icon, Qt::GUIStyle);
- static QT3_SUPPORT int message(const QString &title,
- const QString& text,
- const QString& buttonText=QString(),
- QWidget *parent = 0, const char * = 0) {
- return QMessageBox::information(parent, title, text,
- buttonText.isEmpty() ? tr("OK") : buttonText) == 0;
- }
- static QT3_SUPPORT bool query(const QString &title,
- const QString& text,
- const QString& yesButtonText = QString(),
- const QString& noButtonText = QString(),
- QWidget *parent = 0, const char * = 0) {
- return QMessageBox::information(parent, title, text,
- yesButtonText.isEmpty() ? tr("OK") : yesButtonText,
- noButtonText) == 0;
- }
-#endif
static QPixmap standardIcon(Icon icon);
menuRole(QAction::TextHeuristicRole), softKeyRole(QAction::NoSoftKey),
priority(QAction::NormalPriority)
{
-#ifdef QT3_SUPPORT
- static int qt_static_action_id = -1;
- param = id = --qt_static_action_id;
- act_signal = 0;
-#endif
#ifndef QT_NO_SHORTCUT
shortcutId = 0;
shortcutContext = Qt::WindowShortcut;
return d->font;
}
-#ifdef QT3_SUPPORT
-/*!
- Use one of the QAction constructors that doesn't take a \a name
- argument and call setObjectName() instead.
-*/
-QAction::QAction(QObject* parent, const char* name)
- : QObject(*(new QActionPrivate), parent)
-{
- Q_D(QAction);
- setObjectName(QString::fromAscii(name));
- d->group = qobject_cast<QActionGroup *>(parent);
- if (d->group)
- d->group->addAction(this);
-}
-
-
-/*!
- Use one of the QAction constructors that doesn't take a \a name
- argument and call setObjectName() instead.
-*/
-QAction::QAction(const QString &text, const QKeySequence &shortcut, QObject* parent, const char* name)
- : QObject(*(new QActionPrivate), parent)
-{
- Q_D(QAction);
- setObjectName(QString::fromAscii(name));
- d->text = text;
- setShortcut(shortcut);
- d->group = qobject_cast<QActionGroup *>(parent);
- if (d->group)
- d->group->addAction(this);
-}
-
-/*!
- Use one of the QAction constructors that doesn't take a \a name
- argument and call setObjectName() instead.
-*/
-QAction::QAction(const QIcon &icon, const QString &text, const QKeySequence &shortcut,
- QObject* parent, const char* name)
- : QObject(*(new QActionPrivate), parent)
-{
- Q_D(QAction);
- setObjectName(QString::fromAscii(name));
- d->text = text;
- setShortcut(shortcut);
- d->icon = icon;
- d->group = qobject_cast<QActionGroup *>(parent);
- if (d->group)
- d->group->addAction(this);
-}
-#endif
/*!
Destroys the object and frees allocated resources.
}
if (guard)
emit triggered(d->checked);
-#ifdef QT3_SUPPORT
- if (guard)
- emit activated(d->param);
-#endif
QMetaObject::removeGuard(&guard);
} else if(event == Hover) {
emit hovered();
QAction(const QString &text, QObject* parent);
QAction(const QIcon &icon, const QString &text, QObject* parent);
-#ifdef QT3_SUPPORT
- QT3_SUPPORT_CONSTRUCTOR QAction(QObject* parent, const char* name);
- QT3_SUPPORT_CONSTRUCTOR QAction(const QString &text, const QKeySequence &shortcut,
- QObject* parent, const char* name);
- QT3_SUPPORT_CONSTRUCTOR QAction(const QIcon &icon, const QString &text,
- const QKeySequence &shortcut,
- QObject* parent, const char* name);
-#endif
~QAction();
void setActionGroup(QActionGroup *group);
void setIconVisibleInMenu(bool visible);
bool isIconVisibleInMenu() const;
-#ifdef QT3_SUPPORT
- inline QT3_SUPPORT void setMenuText(const QString &text) { setText(text); }
- inline QT3_SUPPORT QString menuText() const { return text(); }
- inline QT3_SUPPORT bool isOn() const { return isChecked(); }
- inline QT3_SUPPORT bool isToggleAction() const { return isCheckable(); }
- inline QT3_SUPPORT void setToggleAction(bool b) { setCheckable(b); }
- inline QT3_SUPPORT void setIconSet(const QIcon &i) { setIcon(i); }
- inline QT3_SUPPORT QIcon iconSet() const { return icon(); }
- inline QT3_SUPPORT bool addTo(QWidget *w) { w->addAction(this); return true; }
- inline QT3_SUPPORT bool removeFrom(QWidget *w) { w->removeAction(this); return true; }
- inline QT3_SUPPORT void setAccel(const QKeySequence &shortcut) { setShortcut(shortcut); }
- inline QT3_SUPPORT QKeySequence accel() const { return shortcut(); }
-#endif
QWidget *parentWidget() const;
QAction(QActionPrivate &dd, QObject *parent);
public Q_SLOTS:
-#ifdef QT3_SUPPORT
- inline QT_MOC_COMPAT void setOn(bool b) { setChecked(b); }
-#endif
void trigger() { activate(Trigger); }
void hover() { activate(Hover); }
void setChecked(bool);
void triggered(bool checked = false);
void hovered();
void toggled(bool);
-#ifdef QT3_SUPPORT
- QT_MOC_COMPAT void activated(int = 0);
-#endif
private:
Q_DISABLE_COPY(QAction)
-#ifdef QT3_SUPPORT
- friend class QMenuItem;
-#endif
friend class QGraphicsWidget;
friend class QWidget;
friend class QActionGroup;
#ifndef QT_NO_ACTION
-#ifdef QT3_SUPPORT
-class QMenuItemEmitter;
-#endif
class QShortcutMap;
static QShortcutMap *globalMap;
#endif // QT_NO_SHORTCUT
-#ifdef QT3_SUPPORT //for menubar/menu compat
- QMenuItemEmitter *act_signal;
- int id, param;
-#endif
void sendDataChanged();
};
bool isEnabled() const;
bool isVisible() const;
-#ifdef QT3_SUPPORT
- inline QT3_SUPPORT void add(QAction* a) { addAction(a); }
- inline QT3_SUPPORT void addSeparator()
- { QAction *act = new QAction(this); act->setSeparator(true); addAction(act); }
- inline QT3_SUPPORT bool addTo(QWidget *w) { w->addActions(actions()); return true; }
-#endif
public Q_SLOTS:
void setEnabled(bool);
quitOnLastWindowClosed = true;
-#ifdef QT3_SUPPORT
- qt_compat_used = 0;
- qt_compat_resolved = 0;
- qt_tryAccelEvent = 0;
- qt_tryComposeUnicode = 0;
- qt_dispatchAccelEvent = 0;
-#endif
#if defined(Q_WS_QWS) && !defined(QT_NO_DIRECTPAINTER)
directPainters = 0;
#endif
bool QApplication::compressEvent(QEvent *event, QObject *receiver, QPostEventList *postedEvents)
{
if ((event->type() == QEvent::UpdateRequest
-#ifdef QT3_SUPPORT
- || event->type() == QEvent::LayoutHint
-#endif
|| event->type() == QEvent::LayoutRequest
|| event->type() == QEvent::Resize
|| event->type() == QEvent::Move
if (cur.receiver != receiver || cur.event == 0 || cur.event->type() != event->type())
continue;
if (cur.event->type() == QEvent::LayoutRequest
-#ifdef QT3_SUPPORT
- || cur.event->type() == QEvent::LayoutHint
-#endif
|| cur.event->type() == QEvent::UpdateRequest) {
;
} else if (cur.event->type() == QEvent::Resize) {
if (w->windowType() != Qt::Desktop && !w->testAttribute(Qt::WA_SetStyle)) {
QEvent e(QEvent::StyleChange);
QApplication::sendEvent(w, &e);
-#ifdef QT3_SUPPORT
- if (old)
- w->styleChange(*old);
-#endif
w->update();
}
}
language used.
*/
-#ifdef QT3_SUPPORT
-Qt::Alignment QApplication::horizontalAlignment(Qt::Alignment align)
-{
- return QGuiApplicationPrivate::visualAlignment(layoutDirection(), align);
-}
-#endif
/*!
Enters the main event loop and waits until exit() is called, then returns
case QEvent::DragEnter: case QEvent::DragMove: case QEvent::DragLeave:
case QEvent::Drop: case QEvent::DragResponse:
case QEvent::ChildAdded: case QEvent::ChildPolished:
-#ifdef QT3_SUPPORT
- case QEvent::ChildInsertedRequest:
- case QEvent::ChildInserted:
- case QEvent::LayoutHint:
-#endif
case QEvent::ChildRemoved:
case QEvent::UpdateRequest:
case QEvent::UpdateLater:
\snippet doc/src/snippets/code/src_gui_kernel_qapplication.cpp 13
*/
-#ifdef QT3_SUPPORT
-QWidget *QApplication::mainWidget()
-{
- return QApplicationPrivate::main_widget;
-}
-#endif
bool QApplicationPrivate::inPopupMode() const
{
return QApplicationPrivate::popupWidgets != 0;
#ifdef QT_INCLUDE_COMPAT
# include <QtWidgets/qdesktopwidget.h>
#endif
-#ifdef QT3_SUPPORT
-# include <QtWidgets/qwidget.h>
-# include <QtGui/qpalette.h>
-#endif
#ifdef Q_WS_QWS
# include <QtGui/qrgb.h>
# include <QtGui/qtransportauth_qws.h>
static QIcon windowIcon();
-#ifdef QT3_SUPPORT
- static QT3_SUPPORT QWidget *mainWidget();
- static QT3_SUPPORT void setMainWidget(QWidget *);
-#endif
static QWidgetList allWidgets();
static QWidgetList topLevelWidgets();
bool event(QEvent *);
bool compressEvent(QEvent *, QObject *receiver, QPostEventList *);
-#ifdef QT3_SUPPORT
-public:
- static inline QT3_SUPPORT void setReverseLayout(bool b) { setLayoutDirection(b?Qt::RightToLeft:Qt::LeftToRight); }
- static inline bool QT3_SUPPORT reverseLayout() { return layoutDirection() == Qt::RightToLeft; }
- static QT3_SUPPORT Qt::Alignment horizontalAlignment(Qt::Alignment align);
- typedef int ColorMode;
- enum { NormalColors = NormalColor, CustomColors = CustomColor };
- static inline QT3_SUPPORT ColorMode colorMode() { return static_cast<ColorMode>(colorSpec()); }
- static inline QT3_SUPPORT void setColorMode(ColorMode mode) { setColorSpec(int(mode)); }
-#if defined(Q_OS_WIN32) || defined(Q_OS_CYGWIN)
- static QT3_SUPPORT Qt::WindowsVersion winVersion() { return (Qt::WindowsVersion)QSysInfo::WindowsVersion; }
-#endif
-#if defined(Q_OS_MAC)
- static QT3_SUPPORT Qt::MacintoshVersion macVersion() { return (Qt::MacintoshVersion)QSysInfo::MacintoshVersion; }
-#endif
-# ifndef QT_NO_CURSOR
- inline static QT3_SUPPORT void setOverrideCursor(const QCursor &cursor, bool replace)
- { if (replace) changeOverrideCursor(cursor); else setOverrideCursor(cursor); }
-# endif
- inline static QT3_SUPPORT bool hasGlobalMouseTracking() {return true;}
- inline static QT3_SUPPORT void setGlobalMouseTracking(bool) {}
- inline static QT3_SUPPORT void flushX() { flush(); }
- static inline QT3_SUPPORT void setWinStyleHighlightColor(const QColor &c) {
- QPalette p(palette());
- p.setColor(QPalette::Highlight, c);
- setPalette(p);
- }
- static inline QT3_SUPPORT const QColor &winStyleHighlightColor()
- { return palette().color(QPalette::Active, QPalette::Highlight); }
- static inline QT3_SUPPORT void setPalette(const QPalette &pal, bool, const char* className = 0)
- { setPalette(pal, className); }
- static inline QT3_SUPPORT void setFont(const QFont &font, bool, const char* className = 0)
- { setFont(font, className); }
-
- static inline QT3_SUPPORT QWidget *widgetAt(int x, int y, bool child)
- { QWidget *w = widgetAt(x, y); return child ? w : (w ? w->window() : 0); }
- static inline QT3_SUPPORT QWidget *widgetAt(const QPoint &p, bool child)
- { QWidget *w = widgetAt(p); return child ? w : (w ? w->window() : 0); }
-#endif // QT3_SUPPORT
#if defined(Q_INTERNAL_QAPP_SRC) || defined(qdoc)
QApplication(int &argc, char **argv);
# endif
#endif
-#ifdef QT3_SUPPORT
-extern "C" {
- typedef bool (*Ptrqt_tryAccelEvent)(QWidget *w, QKeyEvent *e);
- typedef bool (*Ptrqt_tryComposeUnicode)(QWidget *w, QKeyEvent *e);
- typedef bool (*Ptrqt_dispatchAccelEvent)(QWidget *w, QKeyEvent *e);
-}
-#endif
#if defined(Q_WS_WIN)
typedef BOOL (WINAPI *PtrRegisterTouchWindow)(HWND, ULONG);
QShortcutMap shortcutMap;
#endif
-#ifdef QT3_SUPPORT
- bool qt_compat_used;
- bool qt_compat_resolved;
- Ptrqt_tryAccelEvent qt_tryAccelEvent;
- Ptrqt_tryComposeUnicode qt_tryComposeUnicode;
- Ptrqt_dispatchAccelEvent qt_dispatchAccelEvent;
-
- bool use_compat() {
- return qt_tryAccelEvent
- && qt_tryComposeUnicode
- && qt_dispatchAccelEvent;
- }
-#endif
static QInputContext *inputContext;
static Qt::MouseButtons mouse_buttons;
#endif
}
-#ifdef QT3_SUPPORT
-void QApplication::setMainWidget(QWidget *mainWidget)
-{
- QApplicationPrivate::main_widget = mainWidget;
- if (QApplicationPrivate::main_widget && windowIcon().isNull()
- && QApplicationPrivate::main_widget->testAttribute(Qt::WA_SetWindowIcon))
- setWindowIcon(QApplicationPrivate::main_widget->windowIcon());
-}
-#endif
QT_END_NAMESPACE
d->dir = dir;
}
-#ifdef QT3_SUPPORT
-/*!
- Constructs a new QBoxLayout with direction \a dir and main widget \a
- parent. \a parent may not be 0.
-
- The \a margin is the number of pixels between the edge of the
- widget and its managed children. The \a spacing is the default
- number of pixels between neighboring children. If \a spacing is -1
- the value of \a margin is used for \a spacing.
-
- \a name is the internal object name.
-
- \sa direction()
-*/
-QBoxLayout::QBoxLayout(QWidget *parent, Direction dir,
- int margin, int spacing, const char *name)
- : QLayout(*new QBoxLayoutPrivate, 0, parent)
-{
- Q_D(QBoxLayout);
- d->dir = dir;
- setMargin(margin);
- setObjectName(QString::fromAscii(name));
- setSpacing(spacing<0 ? margin : spacing);
-}
-
-/*!
- Constructs a new QBoxLayout called \a name, with direction \a dir,
- and inserts it into \a parentLayout.
-
- The \a spacing is the default number of pixels between neighboring
- children. If \a spacing is -1, the layout will inherit its
- parent's spacing().
-*/
-QBoxLayout::QBoxLayout(QLayout *parentLayout, Direction dir, int spacing,
- const char *name)
- : QLayout(*new QBoxLayoutPrivate, parentLayout, 0)
-{
- Q_D(QBoxLayout);
- d->dir = dir;
- setObjectName(QString::fromAscii(name));
- setSpacing(spacing);
-}
-
-/*!
- Constructs a new QBoxLayout called \a name, with direction \a dir.
-
- If \a spacing is -1, the layout will inherit its parent's
- spacing(); otherwise \a spacing is used.
-
- You must insert this box into another layout.
-*/
-QBoxLayout::QBoxLayout(Direction dir, int spacing, const char *name)
- : QLayout(*new QBoxLayoutPrivate,0, 0)
-{
- Q_D(QBoxLayout);
- d->dir = dir;
- setObjectName(QString::fromAscii(name));
- setSpacing(spacing);
-}
-#endif // QT3_SUPPORT
/*!
-#ifdef QT3_SUPPORT
-/*!
- Constructs a new top-level horizontal box called \a name, with
- parent \a parent.
-
- The \a margin is the number of pixels between the edge of the
- widget and its managed children. The \a spacing is the default
- number of pixels between neighboring children. If \a spacing is -1
- the value of \a margin is used for \a spacing.
-*/
-QHBoxLayout::QHBoxLayout(QWidget *parent, int margin,
- int spacing, const char *name)
- : QBoxLayout(LeftToRight, parent)
-{
- setMargin(margin);
- setSpacing(spacing<0 ? margin : spacing);
- setObjectName(QString::fromAscii(name));
-}
-
-/*!
- Constructs a new horizontal box called name \a name and adds it to
- \a parentLayout.
-
- The \a spacing is the default number of pixels between neighboring
- children. If \a spacing is -1, this QHBoxLayout will inherit its
- parent's spacing().
-*/
-QHBoxLayout::QHBoxLayout(QLayout *parentLayout, int spacing,
- const char *name)
- : QBoxLayout(LeftToRight)
-{
- setSpacing(spacing);
- setObjectName(QString::fromAscii(name));
- if (parentLayout) {
- setParent(parentLayout);
- parentLayout->addItem(this);
- }
-}
-
-/*!
- Constructs a new horizontal box called name \a name. You must add
- it to another layout.
-
- The \a spacing is the default number of pixels between neighboring
- children. If \a spacing is -1, this QHBoxLayout will inherit its
- parent's spacing().
-*/
-QHBoxLayout::QHBoxLayout(int spacing, const char *name)
- : QBoxLayout(LeftToRight)
-{
- setSpacing(spacing);
- setObjectName(QString::fromAscii(name));
-}
-#endif
/*!
{
}
-#ifdef QT3_SUPPORT
-/*!
- Constructs a new top-level vertical box called \a name, with
- parent \a parent.
-
- The \a margin is the number of pixels between the edge of the
- widget and its managed children. The \a spacing is the default
- number of pixels between neighboring children. If \a spacing is -1
- the value of \a margin is used for \a spacing.
-*/
-QVBoxLayout::QVBoxLayout(QWidget *parent, int margin, int spacing,
- const char *name)
- : QBoxLayout(TopToBottom, parent)
-{
- setMargin(margin);
- setSpacing(spacing<0 ? margin : spacing);
- setObjectName(QString::fromAscii(name));
-}
-
-/*!
- Constructs a new vertical box called name \a name and adds it to
- \a parentLayout.
-
- The \a spacing is the default number of pixels between neighboring
- children. If \a spacing is -1, this QVBoxLayout will inherit its
- parent's spacing().
-*/
-QVBoxLayout::QVBoxLayout(QLayout *parentLayout, int spacing,
- const char *name)
- : QBoxLayout(TopToBottom)
-{
- setSpacing(spacing);
- setObjectName(QString::fromAscii(name));
- if (parentLayout) {
- setParent(parentLayout);
- parentLayout->addItem(this);
- }
-}
-
-/*!
- Constructs a new vertical box called name \a name. You must add
- it to another layout.
-
- The \a spacing is the default number of pixels between neighboring
- children. If \a spacing is -1, this QVBoxLayout will inherit its
- parent's spacing().
-*/
-QVBoxLayout::QVBoxLayout(int spacing, const char *name)
- : QBoxLayout(TopToBottom)
-{
- setSpacing(spacing);
- setObjectName(QString::fromAscii(name));
-}
-
-
-#endif
/*!
Destroys this box layout.
explicit QBoxLayout(Direction, QWidget *parent = 0);
-#ifdef QT3_SUPPORT
- QT3_SUPPORT_CONSTRUCTOR QBoxLayout(QWidget *parent, Direction, int border = 0, int spacing = -1,
- const char *name = 0);
- QT3_SUPPORT_CONSTRUCTOR QBoxLayout(QLayout *parentLayout, Direction, int spacing = -1,
- const char *name = 0);
- QT3_SUPPORT_CONSTRUCTOR QBoxLayout(Direction, int spacing, const char *name = 0);
-#endif
~QBoxLayout();
Direction direction() const;
QLayoutItem *takeAt(int);
int count() const;
void setGeometry(const QRect&);
-#ifdef QT3_SUPPORT
- inline QT3_SUPPORT int findWidget(QWidget* w) {return indexOf(w);}
-#endif
protected:
// ### Qt 5: make public
void insertItem(int index, QLayoutItem *);
explicit QHBoxLayout(QWidget *parent);
~QHBoxLayout();
-#ifdef QT3_SUPPORT
- QT3_SUPPORT_CONSTRUCTOR QHBoxLayout(QWidget *parent, int border,
- int spacing = -1, const char *name = 0);
- QT3_SUPPORT_CONSTRUCTOR QHBoxLayout(QLayout *parentLayout,
- int spacing = -1, const char *name = 0);
- QT3_SUPPORT_CONSTRUCTOR QHBoxLayout(int spacing, const char *name = 0);
-#endif
private:
Q_DISABLE_COPY(QHBoxLayout)
explicit QVBoxLayout(QWidget *parent);
~QVBoxLayout();
-#ifdef QT3_SUPPORT
- QT3_SUPPORT_CONSTRUCTOR QVBoxLayout(QWidget *parent, int border,
- int spacing = -1, const char *name = 0);
- QT3_SUPPORT_CONSTRUCTOR QVBoxLayout(QLayout *parentLayout,
- int spacing = -1, const char *name = 0);
- QT3_SUPPORT_CONSTRUCTOR QVBoxLayout(int spacing, const char *name = 0);
-#endif
private:
Q_DISABLE_COPY(QVBoxLayout)
}
-#ifdef QT3_SUPPORT
-/*!
- \obsolete
- Constructs a new QGridLayout with \a nRows rows, \a nCols columns
- and parent widget, \a parent. \a parent may not be 0. The grid
- layout is called \a name.
-
- \a margin is the number of pixels between the edge of the widget
- and its managed children. \a space is the default number of pixels
- between cells. If \a space is -1, the value of \a margin is used.
-*/
-QGridLayout::QGridLayout(QWidget *parent, int nRows, int nCols, int margin,
- int space, const char *name)
- : QLayout(*new QGridLayoutPrivate, 0, parent)
-{
- Q_D(QGridLayout);
- d->expand(nRows, nCols);
- setMargin(margin);
- setSpacing(space < 0 ? margin : space);
- setObjectName(QString::fromAscii(name));
-}
-
-/*!
- \obsolete
-
- Constructs a new grid with \a nRows rows and \a nCols columns. If
- \a spacing is -1, this QGridLayout inherits its parent's
- spacing(); otherwise \a spacing is used. The grid layout is called
- \a name.
-
- You must insert this grid into another layout. You can insert
- widgets and layouts into this layout at any time, but laying out
- will not be performed before this is inserted into another layout.
-*/
-QGridLayout::QGridLayout(QLayout *parentLayout, int nRows, int nCols,
- int spacing, const char *name)
- : QLayout(*new QGridLayoutPrivate, parentLayout, 0)
-{
- Q_D(QGridLayout);
- d->expand(nRows, nCols);
- setSpacing(spacing);
- setObjectName(QString::fromAscii(name));
-}
-
-/*!
- \obsolete
-
- Constructs a new grid with \a nRows rows and \a nCols columns. If
- \a spacing is -1, this QGridLayout inherits its parent's
- spacing(); otherwise \a spacing is used. The grid layout is called
- \a name.
-
- You must insert this grid into another layout. You can insert
- widgets and layouts into this layout at any time, but laying out
- will not be performed before this is inserted into another layout.
-*/
-QGridLayout::QGridLayout(int nRows, int nCols, int spacing, const char *name)
- : QLayout(*new QGridLayoutPrivate, 0, 0)
-{
- Q_D(QGridLayout);
- d->expand(nRows, nCols);
- setSpacing(spacing);
- setObjectName(QString::fromAscii(name));
-}
-#endif
/*!
return dat->minimumHeightForWidth(w, horizontalSpacing(), verticalSpacing());
}
-#ifdef QT3_SUPPORT
-/*!
- \compat
-
- Searches for widget \a w in this layout (not including child
- layouts). If \a w is found, it sets \c{*}\a{row} and
- \c{*}\a{column} to the row and column that the widget
- occupies and returns true; otherwise returns false.
-
- If the widget spans multiple rows/columns, the top-left cell
- is returned.
-
- Use indexOf() and getItemPosition() instead.
-*/
-bool QGridLayout::findWidget(QWidget* w, int *row, int *column)
-{
- Q_D(QGridLayout);
- int index = indexOf(w);
- if (index < 0)
- return false;
- int dummy1, dummy2;
- d->getItemPosition(index, row, column, &dummy1, &dummy2);
- return true;
-}
-#endif
/*!
\reimp
*/
Q_D(const QGridLayout);
return d->cellRect(row, column);
}
-#ifdef QT3_SUPPORT
-/*!
- \obsolete
- Expands this grid so that it will have \a nRows rows and \a nCols
- columns. Will not shrink the grid. You should not need to call
- this function because QGridLayout expands automatically as new
- items are inserted.
-*/
-void QGridLayout::expand(int nRows, int nCols)
-{
- Q_D(QGridLayout);
- d->expand(nRows, nCols);
-}
-#endif
/*!
\reimp
explicit QGridLayout(QWidget *parent);
QGridLayout();
-#ifdef QT3_SUPPORT
- QT3_SUPPORT_CONSTRUCTOR QGridLayout(QWidget *parent, int nRows , int nCols = 1, int border = 0,
- int spacing = -1, const char *name = 0);
- QT3_SUPPORT_CONSTRUCTOR QGridLayout(int nRows , int nCols = 1, int spacing = -1, const char *name = 0);
- QT3_SUPPORT_CONSTRUCTOR QGridLayout(QLayout *parentLayout, int nRows = 1, int nCols = 1, int spacing = -1,
- const char *name = 0);
-#endif
~QGridLayout();
QSize sizeHint() const;
int rowCount() const;
QRect cellRect(int row, int column) const;
-#ifdef QT3_SUPPORT
- inline QT3_SUPPORT QRect cellGeometry(int row, int column) const {return cellRect(row, column);}
-#endif
bool hasHeightForWidth() const;
int heightForWidth(int) const;
void setOriginCorner(Qt::Corner);
Qt::Corner originCorner() const;
-#ifdef QT3_SUPPORT
- inline QT3_SUPPORT void setOrigin(Qt::Corner corner) { setOriginCorner(corner); }
- inline QT3_SUPPORT Qt::Corner origin() const { return originCorner(); }
-#endif
QLayoutItem *itemAt(int index) const;
QLayoutItem *itemAtPosition(int row, int column) const;
QLayoutItem *takeAt(int index);
void getItemPosition(int idx, int *row, int *column, int *rowSpan, int *columnSpan);
protected:
-#ifdef QT3_SUPPORT
- QT3_SUPPORT bool findWidget(QWidget* w, int *r, int *c);
-#endif
void addItem(QLayoutItem *);
private:
Q_DISABLE_COPY(QGridLayout)
-#ifdef QT3_SUPPORT
-public:
- QT3_SUPPORT void expand(int rows, int cols);
- inline QT3_SUPPORT void addRowSpacing(int row, int minsize) { addItem(new QSpacerItem(0,minsize), row, 0); }
- inline QT3_SUPPORT void addColSpacing(int col, int minsize) { addItem(new QSpacerItem(minsize,0), 0, col); }
- inline QT3_SUPPORT void addMultiCellWidget(QWidget *w, int fromRow, int toRow, int fromCol, int toCol, Qt::Alignment _align = 0)
- { addWidget(w, fromRow, fromCol, (toRow < 0) ? -1 : toRow - fromRow + 1, (toCol < 0) ? -1 : toCol - fromCol + 1, _align); }
- inline QT3_SUPPORT void addMultiCell(QLayoutItem *l, int fromRow, int toRow, int fromCol, int toCol, Qt::Alignment _align = 0)
- { addItem(l, fromRow, fromCol, (toRow < 0) ? -1 : toRow - fromRow + 1, (toCol < 0) ? -1 : toCol - fromCol + 1, _align); }
- inline QT3_SUPPORT void addMultiCellLayout(QLayout *layout, int fromRow, int toRow, int fromCol, int toCol, Qt::Alignment _align = 0)
- { addLayout(layout, fromRow, fromCol, (toRow < 0) ? -1 : toRow - fromRow + 1, (toCol < 0) ? -1 : toCol - fromCol + 1, _align); }
-
- inline QT3_SUPPORT int numRows() const { return rowCount(); }
- inline QT3_SUPPORT int numCols() const { return columnCount(); }
- inline QT3_SUPPORT void setColStretch(int col, int stretch) {setColumnStretch(col, stretch); }
- inline QT3_SUPPORT int colStretch(int col) const {return columnStretch(col); }
- inline QT3_SUPPORT void setColSpacing(int col, int minSize) { setColumnMinimumWidth(col, minSize); }
- inline QT3_SUPPORT int colSpacing(int col) const { return columnMinimumWidth(col); }
- inline QT3_SUPPORT void setRowSpacing(int row, int minSize) {setRowMinimumHeight(row, minSize); }
- inline QT3_SUPPORT int rowSpacing(int row) const {return rowMinimumHeight(row); }
-#endif
};
QT_END_NAMESPACE
return new QSpacerItem(w, h, hPolicy, vPolicy);
}
-#ifdef QT3_SUPPORT
-/*!
- Constructs a new top-level QLayout called \a name, with parent
- widget \a parent. \a parent may not be 0.
-
- The \a margin is the number of pixels between the edge of the
- widget and the managed children. The \a spacing sets the value of
- spacing(), which gives the spacing between the managed widgets. If
- \a spacing is -1 (the default), spacing is set to the value of \a
- margin.
-
- There can be only one top-level layout for a widget. It is
- returned by QWidget::layout()
-
- \sa QWidget::setLayout()
-*/
-QLayout::QLayout(QWidget *parent, int margin, int spacing, const char *name)
- : QObject(*new QLayoutPrivate,parent)
-{
- Q_D(QLayout);
- setObjectName(QString::fromAscii(name));
- setMargin(margin);
- if (spacing < 0)
- d->insideSpacing = margin;
- else
- d->insideSpacing = spacing;
- if (parent) {
- if (parent->layout()) {
- qWarning("QLayout \"%s\" added to %s \"%s\", which already has a layout",
- QObject::objectName().toLocal8Bit().data(), parent->metaObject()->className(),
- parent->objectName().toLocal8Bit().data());
- parent->layout()->setParent(0);
- } else {
- d->topLevel = true;
- parent->d_func()->layout = this;
- QT_TRY {
- invalidate();
- } QT_CATCH(...) {
- parent->d_func()->layout = 0;
- QT_RETHROW;
- }
- }
- }
-}
-
-/*!
- Constructs a new child QLayout called \a name, and places it
- inside \a parentLayout by using the default placement defined by
- addItem().
-
- If \a spacing is -1, this QLayout inherits \a parentLayout's
- spacing(), otherwise the value of \a spacing is used.
-*/
-QLayout::QLayout(QLayout *parentLayout, int spacing, const char *name)
- : QObject(*new QLayoutPrivate,parentLayout)
-
-{
- Q_D(QLayout);
- setObjectName(QString::fromAscii(name));
- d->insideSpacing = spacing;
- parentLayout->addItem(this);
-}
-
-/*!
- Constructs a new child QLayout called \a name. If \a spacing is
- -1, this QLayout inherits its parent's spacing(); otherwise the
- value of \a spacing is used.
-
- This layout has to be inserted into another layout before geometry
- management will work.
-*/
-QLayout::QLayout(int spacing, const char *name)
- : QObject(*new QLayoutPrivate, 0)
-{
- Q_D(QLayout);
- setObjectName(QString::fromAscii(name));
- d->insideSpacing = spacing;
-}
-
-/*!
- Automatically adding widgets is deprecated. Use addWidget() or
- addLayout() instead.
-*/
-void QLayout::setAutoAdd(bool a) { Q_D(QLayout); d->autoNewChild = a; }
-
-/*!
- Automatically adding widgets is deprecated. Use addWidget() or
- addLayout() instead.
-*/
-bool QLayout::autoAdd() const { Q_D(const QLayout); return d->autoNewChild; }
-#endif
/*!
return d->rect.adjusted(+left, +top, -right, -bottom);
}
-#ifdef QT3_SUPPORT
-bool QLayout::isTopLevel() const
-{
- Q_D(const QLayout);
- return d->topLevel;
-}
-#endif
/*!
Returns the parent widget of this layout, or 0 if this layout is
}
}
break;
-#ifdef QT3_SUPPORT
- case QEvent::ChildInserted:
- if (d->topLevel && d->autoNewChild) {
- QChildEvent *c = (QChildEvent *)e;
- if (c->child()->isWidgetType()) {
- QWidget *w = (QWidget *)c->child();
- if (!w->isWindow()) {
-#if !defined(QT_NO_MENUBAR) && !defined(QT_NO_TOOLBAR)
- if (qobject_cast<QMenuBar*>(w) && !qobject_cast<QToolBar*>(w->parentWidget())) {
- d->menubar = (QMenuBar *)w;
- invalidate();
- } else
-#endif
-#ifndef QT_NO_SIZEGRIP
- if (qobject_cast<QSizeGrip*>(w) ) {
- //SizeGrip is handled by the dialog itself.
- } else
-#endif
- addItem(QLayoutPrivate::createWidgetItem(this, w));
- }
- }
- }
- break;
- case QEvent::LayoutHint:
- d->activated = false;
- // fall through
-#endif
case QEvent::LayoutRequest:
if (static_cast<QWidget *>(parent())->isVisible())
activate();
((QWidget*)parent())->d_func()->layout = 0;
}
-#ifdef QT3_SUPPORT
-/*!
- Removes and deletes all items in this layout.
-*/
-void QLayout::deleteAllItems()
-{
- QLayoutItem *l;
- while ((l = takeAt(0)))
- delete l;
-}
-#endif
/*!
This function is called from \c addLayout() or \c insertLayout() functions in
QMetaObject::invokeMethod(w, "_q_showIfNotHidden", Qt::QueuedConnection); //show later
}
-#ifdef QT3_SUPPORT
-/*!
- \compat
-
- Sets this layout's parent widget to a fixed size with width \a w
- and height \a h, stopping the user from resizing it, and also
- prevents the layout from resizing it, even if the layout's size
- hint should change. Does nothing if this is not a top-level
- layout (i.e., if parent()->isWidgetType()).
-
- As a special case, if both \a w and \a h are 0, then the layout's
- current sizeHint() is used.
-
- Use \c setResizeMode(Fixed) to stop the widget from being resized
- by the user, while still allowing the layout to resize it when
- the sizeHint() changes.
-
- Use \c setResizeMode(FreeResize) to allow the user to resize the
- widget, while preventing the layout from resizing it.
-
-*/
-void QLayout::freeze(int w, int h)
-{
- Q_D(QLayout);
- if (!d->topLevel)
- return;
- if (w <= 0 || h <= 0) {
- QSize s = totalSizeHint();
- w = s.width();
- h = s.height();
- }
- setSizeConstraint(SetNoConstraint); // layout will not change min/max size
- QWidget *parent = parentWidget();
- if (parent)
- parent->setFixedSize(w, h);
-}
-
-#endif
class QLayout;
class QSize;
-#ifdef QT3_SUPPORT
-class Q_WIDGETS_EXPORT QLayoutIterator
-{
-public:
- inline QT3_SUPPORT_CONSTRUCTOR QLayoutIterator(QLayout *i) : layout(i), index(0) {}
- inline QLayoutIterator(const QLayoutIterator &i)
- : layout(i.layout), index(i.index) {}
- inline QLayoutIterator &operator=(const QLayoutIterator &i) {
- layout = i.layout;
- index = i.index;
- return *this;
- }
- inline QT3_SUPPORT QLayoutItem *operator++();
- inline QT3_SUPPORT QLayoutItem *current();
- inline QT3_SUPPORT QLayoutItem *takeCurrent();
- inline QT3_SUPPORT void deleteCurrent();
-
-private:
- // hack to avoid deprecated warning
- friend class QLayout;
- inline QLayoutIterator(QLayout *i, bool) : layout(i), index(0) {}
- QLayout *layout;
- int index;
-};
-#endif
class QLayoutPrivate;
void setSizeConstraint(SizeConstraint);
SizeConstraint sizeConstraint() const;
-#ifdef QT3_SUPPORT
- inline QT3_SUPPORT void setResizeMode(SizeConstraint s) {setSizeConstraint(s);}
- inline QT3_SUPPORT SizeConstraint resizeMode() const {return sizeConstraint();}
-#endif
void setMenuBar(QWidget *w);
QWidget *menuBar() const;
void setEnabled(bool);
bool isEnabled() const;
-#ifdef QT3_SUPPORT
- QT3_SUPPORT void freeze(int w=0, int h=0);
- QT3_SUPPORT bool isTopLevel() const;
-#endif
static QSize closestAcceptableSize(const QWidget *w, const QSize &s);
void childEvent(QChildEvent *e);
void addChildLayout(QLayout *l);
void addChildWidget(QWidget *w);
-#ifdef QT3_SUPPORT
- QT3_SUPPORT void deleteAllItems();
-#endif
QRect alignmentRect(const QRect&) const;
protected:
friend class QApplicationPrivate;
friend class QWidget;
-#ifdef QT3_SUPPORT
-public:
- QT3_SUPPORT_CONSTRUCTOR QLayout(QWidget *parent, int margin, int spacing = -1,
- const char *name = 0);
- QT3_SUPPORT_CONSTRUCTOR QLayout(QLayout *parentLayout, int spacing = -1, const char *name = 0);
- QT3_SUPPORT_CONSTRUCTOR QLayout(int spacing, const char *name = 0);
- inline QT3_SUPPORT QWidget *mainWidget() const { return parentWidget(); }
- inline QT3_SUPPORT void remove(QWidget *w) { removeWidget(w); }
- inline QT3_SUPPORT void add(QWidget *w) { addWidget(w); }
-
- QT3_SUPPORT void setAutoAdd(bool a);
- QT3_SUPPORT bool autoAdd() const;
- inline QT3_SUPPORT QLayoutIterator iterator() { return QLayoutIterator(this,true); }
-
- inline QT3_SUPPORT int defaultBorder() const { return spacing(); }
-#endif
};
-#ifdef QT3_SUPPORT
-inline QLayoutItem *QLayoutIterator::operator++() { return layout->itemAt(++index); }
-inline QLayoutItem *QLayoutIterator::current() { return layout->itemAt(index); }
-inline QLayoutItem *QLayoutIterator::takeCurrent() { return layout->takeAt(index); }
-inline void QLayoutIterator::deleteCurrent() { delete layout->takeAt(index); }
-#endif
//### support old includes
#if 1 //def QT3_SUPPORT
void transpose();
-#ifdef QT3_SUPPORT
- typedef Policy SizeType;
-#ifndef qdoc
- typedef Qt::Orientations ExpandData;
- enum {
- NoDirection = 0,
- Horizontally = 1,
- Vertically = 2,
- BothDirections = Horizontally | Vertically
- };
-#else
- enum ExpandData {
- NoDirection = 0x0,
- Horizontally = 0x1,
- Vertically = 0x2,
- BothDirections = 0x3
- };
-#endif // qdoc
-
- inline QT3_SUPPORT bool mayShrinkHorizontally() const
- { return horizontalPolicy() & ShrinkFlag; }
- inline QT3_SUPPORT bool mayShrinkVertically() const { return verticalPolicy() & ShrinkFlag; }
- inline QT3_SUPPORT bool mayGrowHorizontally() const { return horizontalPolicy() & GrowFlag; }
- inline QT3_SUPPORT bool mayGrowVertically() const { return verticalPolicy() & GrowFlag; }
- inline QT3_SUPPORT Qt::Orientations expanding() const { return expandingDirections(); }
-
- QT3_SUPPORT_CONSTRUCTOR QSizePolicy(Policy hor, Policy ver, bool hfw)
- : data(hor | (ver<<HSize) | (hfw ? (1U<<2*HSize) : 0)) { }
-
- QT3_SUPPORT_CONSTRUCTOR QSizePolicy(Policy hor, Policy ver, uchar hors, uchar vers, bool hfw = false)
- : data(hor | (ver<<HSize) | (hfw ? (1U<<2*HSize) : 0)) {
- setHorizontalStretch(hors);
- setVerticalStretch(vers);
- }
-
- inline QT3_SUPPORT Policy horData() const { return static_cast<Policy>(data & HMask); }
- inline QT3_SUPPORT Policy verData() const { return static_cast<Policy>((data & VMask) >> HSize); }
- inline QT3_SUPPORT void setHorData(Policy d) { setHorizontalPolicy(d); }
- inline QT3_SUPPORT void setVerData(Policy d) { setVerticalPolicy(d); }
-
- inline QT3_SUPPORT uint horStretch() const { return horizontalStretch(); }
- inline QT3_SUPPORT uint verStretch() const { return verticalStretch(); }
- inline QT3_SUPPORT void setHorStretch(uchar sf) { setHorizontalStretch(sf); }
- inline QT3_SUPPORT void setVerStretch(uchar sf) { setVerticalStretch(sf); }
-#endif
private:
#ifndef QT_NO_DATASTREAM
static void setPalette(const QPalette &);
static QFont font();
static void setFont(const QFont &);
-#ifdef QT3_SUPPORT
- static inline QT3_SUPPORT void add(QWidget *w, const QString &s) { w->setToolTip(s); }
- static inline QT3_SUPPORT void add(QWidget *w, const QRect &, const QString &s)
- { w->setToolTip(s); }
- static inline QT3_SUPPORT void remove(QWidget *w) { w->setToolTip(QString()); }
-#endif
};
#endif // QT_NO_TOOLTIP
static QWhatsThisPrivate *instance;
bool eventFilter(QObject *, QEvent *);
QPointer<QAction> action;
-#ifdef QT3_SUPPORT
- QPointer<QToolButton> button;
-#endif
static void say(QWidget *, const QString &, int x = 0, int y = 0);
static void notifyToplevels(QEvent *e);
bool leaveOnMouseRelease;
{
if (action)
action->setChecked(false);
-#ifdef QT3_SUPPORT
- if (button)
- button->setChecked(false);
-#endif
#ifndef QT_NO_CURSOR
QApplication::restoreOverrideCursor();
#endif
{
}
-#ifdef QT3_SUPPORT
-/*!
- \obsolete
-
- Sets the What's This text \a s for the widget \a w.
-
- Use QWidget::setWhatsThis() or QAction::setWhatsThis() instead.
-*/
-void QWhatsThis::add(QWidget *w, const QString &s)
-{
- w->setWhatsThis(s);
-}
-
-/*!
- \obsolete
-
- Remove's the What's This text for the widget \a w.
-
- Use QWidget::setWhatsThis() or QAction::setWhatsThis() instead.
-*/
-void QWhatsThis::remove(QWidget *w)
-{
- w->setWhatsThis(QString());
-}
-
-class QWhatsThisButton : public QToolButton
-{
- Q_OBJECT
-public:
- QWhatsThisButton(QWidget *p) : QToolButton(p) {
- setCheckable(true);
- QPixmap pix( const_cast<const char**>(button_image) );
- setIcon( pix );
- QObject::connect(this, SIGNAL(toggled(bool)), this, SLOT(whatToggled(bool)));
- setAutoRaise(true);
- setFocusPolicy(Qt::NoFocus);
- }
-
-public slots:
- void whatToggled(bool b) {
- if (b) {
- QWhatsThis::enterWhatsThisMode();
- QWhatsThisPrivate::instance->button = this;
- }
- }
-};
-
-/*!
- Returns a new "What's This?" QToolButton with the given \a
- parent. To do this now, create your own QToolButton and a
- QWhatsThis object and call the QWhatsThis object's showText()
- function when the QToolButton is invoked.
-
- Use createAction() instead.
-*/
-QToolButton * QWhatsThis::whatsThisButton(QWidget * parent)
-{
- return new QWhatsThisButton(parent);
-}
-#endif
/*!
This function switches the user interface into "What's This?"
#ifndef QT_NO_WHATSTHIS
class QAction;
-#ifdef QT3_SUPPORT
-class QToolButton;
-#endif
class Q_WIDGETS_EXPORT QWhatsThis
{
static QAction *createAction(QObject *parent = 0);
-#ifdef QT3_SUPPORT
- static QT3_SUPPORT void add(QWidget *w, const QString &s);
- static QT3_SUPPORT void remove(QWidget *);
- static QT3_SUPPORT QToolButton *whatsThisButton(QWidget *parent);
-#endif
};
#endif // QT_NO_WHATSTHIS
}
}
-#ifdef QT3_SUPPORT
-/*!
- \overload
- \obsolete
- */
-QWidget::QWidget(QWidget *parent, const char *name, Qt::WindowFlags f)
- : QObject(*new QWidgetPrivate, 0), QPaintDevice()
-{
- QT_TRY {
- d_func()->init(parent , f);
- setObjectName(QString::fromAscii(name));
- } QT_CATCH(...) {
- QWidgetExceptionCleaner::cleanup(this, d_func());
- QT_RETHROW;
- }
-}
-#endif
/*! \internal
*/
}
}
-#ifdef QT3_SUPPORT
- if (flags & Qt::WStaticContents)
- setAttribute(Qt::WA_StaticContents);
- if (flags & Qt::WDestructiveClose)
- setAttribute(Qt::WA_DeleteOnClose);
- if (flags & Qt::WShowModal)
- setWindowModality(Qt::ApplicationModal);
- if (flags & Qt::WMouseNoMask)
- setAttribute(Qt::WA_MouseNoMask);
- if (flags & Qt::WGroupLeader)
- setAttribute(Qt::WA_GroupLeader);
- if (flags & Qt::WNoMousePropagation)
- setAttribute(Qt::WA_NoMousePropagation);
-#endif
static int paintOnScreenEnv = -1;
if (paintOnScreenEnv == -1)
d->focus_next = d->focus_prev = 0;
}
-#ifdef QT3_SUPPORT
- if (QApplicationPrivate::main_widget == this) { // reset main widget
- QApplicationPrivate::main_widget = 0;
- QApplication::quit();
- }
-#endif
QT_TRY {
clearFocus();
QEvent e(QEvent::StyleChange);
QApplication::sendEvent(q, &e);
-#ifdef QT3_SUPPORT
- q->styleChange(*oldStyle);
-#endif
#ifndef QT_NO_STYLE_STYLESHEET
// dereference the old stylesheet style
#endif // QT_NO_STYLE_STYLESHEET
}
-#ifdef QT3_SUPPORT
-/*!
- \overload
-
- Sets the widget's GUI style to \a style using the QStyleFactory.
-*/
-QStyle* QWidget::setStyle(const QString &style)
-{
- QStyle *s = QStyleFactory::create(style);
- setStyle(s);
- return s;
-}
-#endif
/*!
\fn bool QWidget::isWindow() const
return;
ensurePolished();
-#ifdef QT3_SUPPORT
- if (parent())
- QApplication::sendPostedEvents(parent(), QEvent::ChildInserted);
-#endif
if (!isMin)
setWindowState((windowState() & ~Qt::WindowActive) | Qt::WindowMinimized);
}
#endif // Q_WS_MAC
ensurePolished();
-#ifdef QT3_SUPPORT
- if (parent())
- QApplication::sendPostedEvents(parent(), QEvent::ChildInserted);
-#endif
setWindowState((windowState() & ~(Qt::WindowMinimized | Qt::WindowMaximized))
| Qt::WindowFullScreen);
void QWidget::showMaximized()
{
ensurePolished();
-#ifdef QT3_SUPPORT
- if (parent())
- QApplication::sendPostedEvents(parent(), QEvent::ChildInserted);
-#endif
setWindowState((windowState() & ~(Qt::WindowMinimized | Qt::WindowFullScreen))
| Qt::WindowMaximized);
void QWidget::showNormal()
{
ensurePolished();
-#ifdef QT3_SUPPORT
- if (parent())
- QApplication::sendPostedEvents(parent(), QEvent::ChildInserted);
-#endif
setWindowState(windowState() & ~(Qt::WindowMinimized
| Qt::WindowMaximized
#endif //QT_NO_IM
QEvent e(QEvent::EnabledChange);
QApplication::sendEvent(q, &e);
-#ifdef QT3_SUPPORT
- q->enabledChange(!enable); // compatibility
-#endif
}
/*!
Use window() instead.
*/
-#ifdef QT3_SUPPORT
-/*!
- Returns the color role used for painting the widget's background.
-
- Use QPalette(backgroundRole(()) instead.
-*/
-Qt::BackgroundMode QWidget::backgroundMode() const
-{
- if (testAttribute(Qt::WA_NoSystemBackground))
- return Qt::NoBackground;
- switch(backgroundRole()) {
- case QPalette::WindowText:
- return Qt::PaletteForeground;
- case QPalette::Button:
- return Qt::PaletteButton;
- case QPalette::Light:
- return Qt::PaletteLight;
- case QPalette::Midlight:
- return Qt::PaletteMidlight;
- case QPalette::Dark:
- return Qt::PaletteDark;
- case QPalette::Mid:
- return Qt::PaletteMid;
- case QPalette::Text:
- return Qt::PaletteText;
- case QPalette::BrightText:
- return Qt::PaletteBrightText;
- case QPalette::Base:
- return Qt::PaletteBase;
- case QPalette::Window:
- return Qt::PaletteBackground;
- case QPalette::Shadow:
- return Qt::PaletteShadow;
- case QPalette::Highlight:
- return Qt::PaletteHighlight;
- case QPalette::HighlightedText:
- return Qt::PaletteHighlightedText;
- case QPalette::ButtonText:
- return Qt::PaletteButtonText;
- case QPalette::Link:
- return Qt::PaletteLink;
- case QPalette::LinkVisited:
- return Qt::PaletteLinkVisited;
- default:
- break;
- }
- return Qt::NoBackground;
-}
-
-/*!
- \fn void QWidget::setBackgroundMode(Qt::BackgroundMode
- widgetBackground, Qt::BackgroundMode paletteBackground)
-
- Sets the color role used for painting the widget's background to
- background mode \a widgetBackground. The \a paletteBackground mode
- parameter is ignored.
-*/
-void QWidget::setBackgroundMode(Qt::BackgroundMode m, Qt::BackgroundMode)
-{
- Q_D(QWidget);
- if(m == Qt::NoBackground) {
- setAttribute(Qt::WA_NoSystemBackground, true);
- return;
- }
- setAttribute(Qt::WA_NoSystemBackground, false);
- d->fg_role = QPalette::NoRole;
- QPalette::ColorRole role = d->bg_role;
- switch(m) {
- case Qt::FixedColor:
- case Qt::FixedPixmap:
- break;
- case Qt::PaletteForeground:
- role = QPalette::WindowText;
- break;
- case Qt::PaletteButton:
- role = QPalette::Button;
- break;
- case Qt::PaletteLight:
- role = QPalette::Light;
- break;
- case Qt::PaletteMidlight:
- role = QPalette::Midlight;
- break;
- case Qt::PaletteDark:
- role = QPalette::Dark;
- break;
- case Qt::PaletteMid:
- role = QPalette::Mid;
- break;
- case Qt::PaletteText:
- role = QPalette::Text;
- break;
- case Qt::PaletteBrightText:
- role = QPalette::BrightText;
- break;
- case Qt::PaletteBase:
- role = QPalette::Base;
- break;
- case Qt::PaletteBackground:
- role = QPalette::Window;
- break;
- case Qt::PaletteShadow:
- role = QPalette::Shadow;
- break;
- case Qt::PaletteHighlight:
- role = QPalette::Highlight;
- break;
- case Qt::PaletteHighlightedText:
- role = QPalette::HighlightedText;
- break;
- case Qt::PaletteButtonText:
- role = QPalette::ButtonText;
- break;
- case Qt::PaletteLink:
- role = QPalette::Link;
- break;
- case Qt::PaletteLinkVisited:
- role = QPalette::LinkVisited;
- break;
- case Qt::X11ParentRelative:
- d->fg_role = role = QPalette::NoRole;
- default:
- break;
- }
- setBackgroundRole(role);
-}
-
-/*!
- The widget mapper is no longer part of the public API.
-*/
-QT3_SUPPORT QWidgetMapper *QWidget::wmapper() { return QWidgetPrivate::mapper; }
-
-#endif
/*!
cssStyle = extra ? qobject_cast<const QStyleSheetStyle*>(extra->style) : 0;
#endif
-#ifdef QT3_SUPPORT
- QFont old = data.fnt;
-#endif
data.fnt = QFont(font, q);
#if defined(Q_WS_X11)
// make sure the font set on this widget is associated with the correct screen
QEvent e(QEvent::FontChange);
QApplication::sendEvent(q, &e);
-#ifdef QT3_SUPPORT
- q->fontChange(old);
-#endif
}
void QWidgetPrivate::setLayoutDirection_helper(Qt::LayoutDirection direction)
createRecursively();
q->ensurePolished();
-#ifdef QT3_SUPPORT
- if(sendChildEvents)
- QApplication::sendPostedEvents(q, QEvent::ChildInserted);
-#endif
if (!q->isWindow() && q->parentWidget()->d_func()->layout && !q->parentWidget()->data->in_show)
q->parentWidget()->d_func()->layout->activate();
// activate our layout before we and our children become visible
// finally show all children recursively
showChildren(false);
-#ifdef QT3_SUPPORT
- if (q->parentWidget() && sendChildEvents)
- QApplication::sendPostedEvents(q->parentWidget(),
- QEvent::ChildInserted);
-#endif
// popup handling: new popups and tools need to be raised, and
if (needUpdateGeometry)
d->updateGeometry_helper(true);
-#ifdef QT3_SUPPORT
- QApplication::sendPostedEvents(this, QEvent::ChildInserted);
-#endif
// activate our layout before we and our children become visible
if (d->layout)
d->layout->activate();
QPointer<QWidget> that = q;
QPointer<QWidget> parentWidget = q->parentWidget();
-#ifdef QT3_SUPPORT
- bool isMain = (QApplicationPrivate::main_widget == q);
-#endif
bool quitOnClose = q->testAttribute(Qt::WA_QuitOnClose);
if (mode != CloseNoEvent) {
QCloseEvent e;
if (!that.isNull() && !q->isHidden())
q->hide();
-#ifdef QT3_SUPPORT
- if (isMain)
- QApplication::quit();
-#endif
// Attempt to close the application only if this has WA_QuitOnClose set and a non-visible parent
quitOnClose = quitOnClose && (parentWidget.isNull() || !parentWidget->isVisible());
return !w->isHidden();
}
-#ifdef QT3_SUPPORT
-/*!
- Use visibleRegion() instead.
-*/
-QRect QWidget::visibleRect() const
-{
- return d_func()->clipRect();
-}
-#endif
/*!
Returns the unobscured region where paint events can occur.
tabletEvent((QTabletEvent*)event);
break;
#endif
-#ifdef QT3_SUPPORT
- case QEvent::Accel:
- event->ignore();
- return false;
-#endif
case QEvent::KeyPress: {
QKeyEvent *k = (QKeyEvent *)event;
bool res = false;
d->resolveFont();
if (!QApplication::palette(this).isCopyOf(QApplication::palette()))
d->resolvePalette();
-#ifdef QT3_SUPPORT
- if(d->sendChildEvents)
- QApplication::sendPostedEvents(this, QEvent::ChildInserted);
-#endif
}
break;
case QEvent::WindowActivate:
case QEvent::WindowDeactivate: {
-#ifdef QT3_SUPPORT
- windowActivationChange(event->type() != QEvent::WindowActivate);
-#endif
if (isVisible() && !palette().isEqual(QPalette::Active, QPalette::Inactive))
update();
QList<QObject*> childList = d->children;
break; }
case QEvent::LanguageChange:
-#ifdef QT3_SUPPORT
- languageChange();
-#endif
changeEvent(event);
{
QList<QObject*> childList = d->children;
if (parent && d->sendChildEvents) {
QChildEvent e(QEvent::ChildAdded, this);
QApplication::sendEvent(parent, &e);
-#ifdef QT3_SUPPORT
- if (parent->d_func()->pendingChildInsertedEvents.isEmpty()) {
- QApplication::postEvent(parent,
- new QEvent(QEvent::ChildInsertedRequest),
- Qt::HighEventPriority);
- }
- parent->d_func()->pendingChildInsertedEvents.append(this);
-#endif
}
//### already hidden above ---> must probably do something smart on the mac
}
}
-#ifdef QT3_SUPPORT
-/*!
- Clear the rectangle at point (\a x, \a y) of width \a w and height
- \a h.
-
- \warning This is best done in a paintEvent().
-*/
-void QWidget::erase_helper(int x, int y, int w, int h)
-{
- if (testAttribute(Qt::WA_NoSystemBackground) || testAttribute(Qt::WA_UpdatesDisabled) || !testAttribute(Qt::WA_WState_Visible))
- return;
- if (w < 0)
- w = data->crect.width() - x;
- if (h < 0)
- h = data->crect.height() - y;
- if (w != 0 && h != 0) {
- QPainter p(this);
- p.eraseRect(QRect(x, y, w, h));
- }
-}
-
-/*!
- \overload
-
- Clear the given region, \a rgn.
-
- Drawing may only take place in a QPaintEvent. Overload
- paintEvent() to do your erasing and call update() to schedule a
- replaint whenever necessary. See also QPainter.
-*/
-void QWidget::erase(const QRegion& rgn)
-{
- if (testAttribute(Qt::WA_NoSystemBackground) || testAttribute(Qt::WA_UpdatesDisabled) || !testAttribute(Qt::WA_WState_Visible))
- return;
-
- QPainter p(this);
- p.setClipRegion(rgn);
- p.eraseRect(rgn.boundingRect());
-}
-
-void QWidget::drawText_helper(int x, int y, const QString &str)
-{
- if(!testAttribute(Qt::WA_WState_Visible))
- return;
- QPainter paint(this);
- paint.drawText(x, y, str);
-}
-
-
-/*!
- Closes the widget.
-
- Use the no-argument overload instead.
-*/
-bool QWidget::close(bool alsoDelete)
-{
- QPointer<QWidget> that = this;
- bool accepted = close();
- if (alsoDelete && accepted && that)
- deleteLater();
- return accepted;
-}
-
-void QWidget::setIcon(const QPixmap &i)
-{
- setWindowIcon(i);
-}
-
-/*!
- Return's the widget's icon.
-
- Use windowIcon() instead.
-*/
-const QPixmap *QWidget::icon() const
-{
- Q_D(const QWidget);
- return (d->extra && d->extra->topextra) ? d->extra->topextra->iconPixmap : 0;
-}
-
-#endif // QT3_SUPPORT
/*!
\internal
Q_DECLARE_FLAGS(RenderFlags, RenderFlag)
explicit QWidget(QWidget* parent = 0, Qt::WindowFlags f = 0);
-#ifdef QT3_SUPPORT
- QT3_SUPPORT_CONSTRUCTOR QWidget(QWidget* parent, const char *name, Qt::WindowFlags f = 0);
-#endif
~QWidget();
int devType() const;
inline Qt::WindowType windowType() const;
static QWidget *find(WId);
-#ifdef QT3_SUPPORT
- static QT3_SUPPORT QWidgetMapper *wmapper();
-#endif
inline QWidget *childAt(int x, int y) const;
QWidget *childAt(const QPoint &p) const;
QWidgetData *data;
-#ifdef QT3_SUPPORT
-public:
- inline QT3_SUPPORT bool isUpdatesEnabled() const { return updatesEnabled(); }
- QT3_SUPPORT QStyle *setStyle(const QString&);
- inline QT3_SUPPORT bool isVisibleToTLW() const;
- QT3_SUPPORT QRect visibleRect() const;
- inline QT3_SUPPORT void iconify() { showMinimized(); }
- inline QT3_SUPPORT void constPolish() const { ensurePolished(); }
- inline QT3_SUPPORT void polish() { ensurePolished(); }
- inline QT3_SUPPORT void reparent(QWidget *parent, Qt::WindowFlags f, const QPoint &p, bool showIt=false)
- { setParent(parent, f); setGeometry(p.x(),p.y(),width(),height()); if (showIt) show(); }
- inline QT3_SUPPORT void reparent(QWidget *parent, const QPoint &p, bool showIt=false)
- { setParent(parent, windowFlags() & ~Qt::WindowType_Mask); setGeometry(p.x(),p.y(),width(),height()); if (showIt) show(); }
- inline QT3_SUPPORT void recreate(QWidget *parent, Qt::WindowFlags f, const QPoint & p, bool showIt=false)
- { setParent(parent, f); setGeometry(p.x(),p.y(),width(),height()); if (showIt) show(); }
- inline QT3_SUPPORT void setSizePolicy(QSizePolicy::Policy hor, QSizePolicy::Policy ver, bool hfw)
- { QSizePolicy sp(hor, ver); sp.setHeightForWidth(hfw); setSizePolicy(sp);}
- inline QT3_SUPPORT bool hasMouse() const { return testAttribute(Qt::WA_UnderMouse); }
-#ifndef QT_NO_CURSOR
- inline QT3_SUPPORT bool ownCursor() const { return testAttribute(Qt::WA_SetCursor); }
-#endif
- inline QT3_SUPPORT bool ownFont() const { return testAttribute(Qt::WA_SetFont); }
- inline QT3_SUPPORT void unsetFont() { setFont(QFont()); }
- inline QT3_SUPPORT bool ownPalette() const { return testAttribute(Qt::WA_SetPalette); }
- inline QT3_SUPPORT void unsetPalette() { setPalette(QPalette()); }
- Qt::BackgroundMode QT3_SUPPORT backgroundMode() const;
- void QT3_SUPPORT setBackgroundMode(Qt::BackgroundMode, Qt::BackgroundMode = Qt::PaletteBackground);
- const QT3_SUPPORT QColor &eraseColor() const;
- void QT3_SUPPORT setEraseColor(const QColor &);
- const QT3_SUPPORT QColor &foregroundColor() const;
- const QT3_SUPPORT QPixmap *erasePixmap() const;
- void QT3_SUPPORT setErasePixmap(const QPixmap &);
- const QT3_SUPPORT QColor &paletteForegroundColor() const;
- void QT3_SUPPORT setPaletteForegroundColor(const QColor &);
- const QT3_SUPPORT QColor &paletteBackgroundColor() const;
- void QT3_SUPPORT setPaletteBackgroundColor(const QColor &);
- const QT3_SUPPORT QPixmap *paletteBackgroundPixmap() const;
- void QT3_SUPPORT setPaletteBackgroundPixmap(const QPixmap &);
- const QT3_SUPPORT QBrush& backgroundBrush() const;
- const QT3_SUPPORT QColor &backgroundColor() const;
- const QT3_SUPPORT QPixmap *backgroundPixmap() const;
- void QT3_SUPPORT setBackgroundPixmap(const QPixmap &);
- QT3_SUPPORT void setBackgroundColor(const QColor &);
- QT3_SUPPORT QWidget *parentWidget(bool sameWindow) const;
- inline QT3_SUPPORT void setKeyCompression(bool b) { setAttribute(Qt::WA_KeyCompression, b); }
- inline QT3_SUPPORT void setFont(const QFont &f, bool) { setFont(f); }
- inline QT3_SUPPORT void setPalette(const QPalette &p, bool) { setPalette(p); }
- enum BackgroundOrigin { WidgetOrigin, ParentOrigin, WindowOrigin, AncestorOrigin };
- inline QT3_SUPPORT void setBackgroundOrigin(BackgroundOrigin) {}
- inline QT3_SUPPORT BackgroundOrigin backgroundOrigin() const { return WindowOrigin; }
- inline QT3_SUPPORT QPoint backgroundOffset() const { return QPoint(); }
- inline QT3_SUPPORT void repaint(bool) { repaint(); }
- inline QT3_SUPPORT void repaint(int x, int y, int w, int h, bool) { repaint(x,y,w,h); }
- inline QT3_SUPPORT void repaint(const QRect &r, bool) { repaint(r); }
- inline QT3_SUPPORT void repaint(const QRegion &rgn, bool) { repaint(rgn); }
- QT3_SUPPORT void erase();
- inline QT3_SUPPORT void erase(int x, int y, int w, int h) { erase_helper(x, y, w, h); }
- QT3_SUPPORT void erase(const QRect &);
- QT3_SUPPORT void erase(const QRegion &);
- QT3_SUPPORT void drawText(const QPoint &p, const QString &s)
- { drawText_helper(p.x(), p.y(), s); }
- inline QT3_SUPPORT void drawText(int x, int y, const QString &s)
- { drawText_helper(x, y, s); }
- QT3_SUPPORT bool close(bool);
- inline QT3_SUPPORT QWidget *childAt(int x, int y, bool includeThis) const
- {
- QWidget *w = childAt(x, y);
- return w ? w : ((includeThis && rect().contains(x,y))?const_cast<QWidget*>(this):0);
- }
- inline QT3_SUPPORT QWidget *childAt(const QPoint &p, bool includeThis) const
- {
- QWidget *w = childAt(p);
- return w ? w : ((includeThis && rect().contains(p))?const_cast<QWidget*>(this):0);
- }
- inline QT3_SUPPORT void setCaption(const QString &c) { setWindowTitle(c); }
- QT3_SUPPORT void setIcon(const QPixmap &i);
- inline QT3_SUPPORT void setIconText(const QString &it) { setWindowIconText(it); }
- inline QT3_SUPPORT QString caption() const { return windowTitle(); }
- QT3_SUPPORT const QPixmap *icon() const;
- inline QT3_SUPPORT QString iconText() const { return windowIconText(); }
- inline QT3_SUPPORT void setInputMethodEnabled(bool b) { setAttribute(Qt::WA_InputMethodEnabled, b); }
- inline QT3_SUPPORT bool isInputMethodEnabled() const { return testAttribute(Qt::WA_InputMethodEnabled); }
- inline QT3_SUPPORT void setActiveWindow() { activateWindow(); }
- inline QT3_SUPPORT bool isShown() const { return !isHidden(); }
- inline QT3_SUPPORT bool isDialog() const { return windowType() == Qt::Dialog; }
- inline QT3_SUPPORT bool isPopup() const { return windowType() == Qt::Popup; }
- inline QT3_SUPPORT bool isDesktop() const { return windowType() == Qt::Desktop; }
-
-
-private:
- void drawText_helper(int x, int y, const QString &);
- void erase_helper(int x, int y, int w, int h);
-#endif // QT3_SUPPORT
protected:
virtual void styleChange(QStyle&); // compat
return testAttribute_helper(attribute);
}
-#ifdef QT3_SUPPORT
-inline bool QWidget::isVisibleToTLW() const
-{ return isVisible(); }
-inline QWidget *QWidget::parentWidget(bool sameWindow) const
-{
- if (sameWindow && isWindow())
- return 0;
- return static_cast<QWidget *>(QObject::parent());
-}
-inline void QWidget::setPaletteForegroundColor(const QColor &c)
-{ QPalette p = palette(); p.setColor(foregroundRole(), c); setPalette(p); }
-inline const QBrush& QWidget::backgroundBrush() const { return palette().brush(backgroundRole()); }
-inline void QWidget::setBackgroundPixmap(const QPixmap &pm)
-{ QPalette p = palette(); p.setBrush(backgroundRole(), QBrush(pm)); setPalette(p); }
-inline const QPixmap *QWidget::backgroundPixmap() const { return 0; }
-inline void QWidget::setBackgroundColor(const QColor &c)
-{ QPalette p = palette(); p.setColor(backgroundRole(), c); setPalette(p); }
-inline const QColor & QWidget::backgroundColor() const { return palette().color(backgroundRole()); }
-inline const QColor &QWidget::foregroundColor() const { return palette().color(foregroundRole());}
-inline const QColor &QWidget::eraseColor() const { return palette().color(backgroundRole()); }
-inline void QWidget::setEraseColor(const QColor &c)
-{ QPalette p = palette(); p.setColor(backgroundRole(), c); setPalette(p); }
-inline const QPixmap *QWidget::erasePixmap() const { return 0; }
-inline void QWidget::setErasePixmap(const QPixmap &pm)
-{ QPalette p = palette(); p.setBrush(backgroundRole(), QBrush(pm)); setPalette(p); }
-inline const QColor &QWidget::paletteForegroundColor() const { return palette().color(foregroundRole());}
-inline const QColor &QWidget::paletteBackgroundColor() const { return palette().color(backgroundRole()); }
-inline void QWidget::setPaletteBackgroundColor(const QColor &c)
-{ QPalette p = palette(); p.setColor(backgroundRole(), c); setPalette(p); }
-inline const QPixmap *QWidget::paletteBackgroundPixmap() const
-{ return 0; }
-inline void QWidget::setPaletteBackgroundPixmap(const QPixmap &pm)
-{ QPalette p = palette(); p.setBrush(backgroundRole(), QBrush(pm)); setPalette(p); }
-inline QT3_SUPPORT void QWidget::erase() { erase_helper(0, 0, data->crect.width(), data->crect.height()); }
-inline QT3_SUPPORT void QWidget::erase(const QRect &r) { erase_helper(r.x(), r.y(), r.width(), r.height()); }
-#endif
#define QWIDGETSIZE_MAX ((1<<24)-1)
return ret;
}
-#ifdef QT3_SUPPORT
-class QMacPasteboardMimeQt3Any : public QMacPasteboardMime {
-private:
- int current_max;
- QFile library_file;
- QDateTime mime_registry_loaded;
- QMap<QString, int> mime_registry;
- int registerMimeType(const QString &mime);
- bool loadMimeRegistry();
-
-public:
- QMacPasteboardMimeQt3Any() : QMacPasteboardMime(MIME_QT3_CONVERTOR) {
- current_max = 'QT00';
- }
- ~QMacPasteboardMimeQt3Any() {
- }
- QString convertorName();
-
- QString flavorFor(const QString &mime);
- QString mimeFor(QString flav);
- bool canConvert(const QString &mime, QString flav);
- QVariant convertToMime(const QString &mime, QList<QByteArray> data, QString flav);
- QList<QByteArray> convertFromMime(const QString &mime, QVariant data, QString flav);
-};
-
-static bool qt_mac_openMimeRegistry(bool global, QIODevice::OpenMode mode, QFile &file)
-{
- QString dir = QLatin1String("/Library/Qt");
- if(!global)
- dir.prepend(QDir::homePath());
- file.setFileName(dir + QLatin1String("/.mime_types"));
- if(mode != QIODevice::ReadOnly) {
- if(!QFile::exists(dir)) {
- // Do it with a system call as I don't see much worth in
- // doing it with QDir since we have to chmod anyway.
- bool success = ::mkdir(dir.toLocal8Bit().constData(), S_IRUSR | S_IWUSR | S_IXUSR) == 0;
- if (success)
- success = ::chmod(dir.toLocal8Bit().constData(), S_IRUSR | S_IWUSR | S_IXUSR
- | S_IRGRP | S_IWGRP | S_IXGRP | S_IROTH | S_IWOTH | S_IXOTH) == 0;
- if (!success)
- return false;
- }
- if (!file.exists()) {
- // Create the file and chmod it so that everyone can write to it.
- int fd = ::open(file.fileName().toLocal8Bit().constData(), O_WRONLY | O_CREAT, S_IRUSR | S_IWUSR);
- bool success = fd != -1;
- if (success)
- success = ::fchmod(fd, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH) == 0;
- if (fd != -1)
- ::close(fd);
- if(!success)
- return false;
- }
- }
- return file.open(mode);
-}
-
-static void qt_mac_loadMimeRegistry(QFile &file, QMap<QString, int> ®istry, int &max)
-{
- file.reset();
- QTextStream stream(&file);
- while(!stream.atEnd()) {
- QString mime = stream.readLine();
- int mactype = stream.readLine().toInt();
- if(mactype > max)
- max = mactype;
- registry.insert(mime, mactype);
- }
-}
-
-bool QMacPasteboardMimeQt3Any::loadMimeRegistry()
-{
- if(!library_file.isOpen()) {
- if(!qt_mac_openMimeRegistry(true, QIODevice::ReadWrite, library_file)) {
- QFile global;
- if(qt_mac_openMimeRegistry(true, QIODevice::ReadOnly, global)) {
- qt_mac_loadMimeRegistry(global, mime_registry, current_max);
- global.close();
- }
- if(!qt_mac_openMimeRegistry(false, QIODevice::ReadWrite, library_file)) {
- qWarning("QMacPasteboardMimeAnyQt3Mime: Failure to open mime resources %s -- %s", library_file.fileName().toLatin1().constData(),
- library_file.errorString().toLatin1().constData());
- return false;
- }
- }
- }
-
- QFileInfo fi(library_file);
- if(!mime_registry_loaded.isNull() && mime_registry_loaded == fi.lastModified())
- return true;
- mime_registry_loaded = fi.lastModified();
- qt_mac_loadMimeRegistry(library_file, mime_registry, current_max);
- return true;
-}
-
-int QMacPasteboardMimeQt3Any::registerMimeType(const QString &mime)
-{
- if(!mime_registry.contains(mime)) {
- if(!loadMimeRegistry()) {
- qWarning("QMacPasteboardMimeAnyQt3Mime: Internal error");
- return 0;
- }
- if(!mime_registry.contains(mime)) {
- if(!library_file.isOpen()) {
- if(!library_file.open(QIODevice::WriteOnly)) {
- qWarning("QMacPasteboardMimeAnyQt3Mime: Failure to open %s -- %s", library_file.fileName().toLatin1().constData(),
- library_file.errorString().toLatin1().constData());
- return false;
- }
- }
- int ret = ++current_max;
- mime_registry_loaded = QFileInfo(library_file).lastModified();
- QTextStream stream(&library_file);
- stream << mime << endl;
- stream << ret << endl;
- mime_registry.insert(mime, ret);
- library_file.flush(); //flush and set mtime
- return ret;
- }
- }
- return mime_registry[mime];
-}
-
-QString QMacPasteboardMimeQt3Any::convertorName()
-{
- return QLatin1String("Qt3-Any-Mime");
-}
-
-QString QMacPasteboardMimeQt3Any::flavorFor(const QString &mime)
-{
- const int os_flav = registerMimeType(mime);
- QCFType<CFArrayRef> ids = UTTypeCreateAllIdentifiersForTag(0, kUTTagClassOSType,
- QCFString(UTCreateStringForOSType(os_flav)));
- if(ids) {
- const int type_count = CFArrayGetCount(ids);
- if(type_count) {
- if(type_count > 1)
- qDebug("Can't happen!");
- return QCFString::toQString((CFStringRef)CFArrayGetValueAtIndex(ids, 0));
- }
- }
- return QString();
-}
-
-QString QMacPasteboardMimeQt3Any::mimeFor(QString flav)
-{
- loadMimeRegistry();
- const int os_flav = UTGetOSTypeFromString(UTTypeCopyPreferredTagWithClass(QCFString(flav), kUTTagClassOSType));
- for(QMap<QString, int>::const_iterator it = mime_registry.constBegin();
- it != mime_registry.constEnd(); ++it) {
- if(it.value() == os_flav)
- return QString::fromLatin1(it.key().toLatin1());
- }
- return QString();
-}
-
-bool QMacPasteboardMimeQt3Any::canConvert(const QString &mime, QString flav)
-{
- loadMimeRegistry();
- const int os_flav = UTGetOSTypeFromString(UTTypeCopyPreferredTagWithClass(QCFString(flav), kUTTagClassOSType));
- if(mime_registry.contains(mime) && mime_registry[mime] == os_flav)
- return true;
- return false;
-}
-
-QVariant QMacPasteboardMimeQt3Any::convertToMime(const QString &, QList<QByteArray>, QString)
-{
- qWarning("QMacPasteboardMimeAnyQt3Mime: Cannot write anything!");
- return QVariant();
-}
-
-QList<QByteArray> QMacPasteboardMimeQt3Any::convertFromMime(const QString &mime, QVariant data, QString)
-{
- QList<QByteArray> ret;
- if (mime == QLatin1String("text/plain")) {
- ret.append(data.toString().toUtf8());
- } else {
- ret.append(data.toByteArray());
- }
- return ret;
-}
-#endif
/*!
\internal
new QMacPasteboardMimeVCard;
//make sure our "non-standard" types are always last! --Sam
new QMacPasteboardMimeAny;
-#ifdef QT3_SUPPORT
- new QMacPasteboardMimeQt3Any;
-#endif
}
}
Platform specific QApplication members
*****************************************************************************/
-#ifdef QT3_SUPPORT
-void QApplication::setMainWidget(QWidget *mainWidget)
-{
- QApplicationPrivate::main_widget = mainWidget;
- if (QApplicationPrivate::main_widget && windowIcon().isNull()
- && QApplicationPrivate::main_widget->testAttribute(Qt::WA_SetWindowIcon))
- setWindowIcon(QApplicationPrivate::main_widget->windowIcon());
-}
-#endif
#ifndef QT_NO_CURSOR
Platform specific QApplication members
*****************************************************************************/
-#ifdef QT3_SUPPORT
-void QApplication::setMainWidget(QWidget *mainWidget)
-{
-#ifndef QT_NO_DEBUG
- if (mainWidget && mainWidget->parentWidget() && mainWidget->isWindow())
- qWarning("QApplication::setMainWidget: New main widget (%s/%s) "
- "has a parent",
- mainWidget->metaObject()->className(), mainWidget->objectName().toLocal8Bit().constData());
-#endif
- if (mainWidget)
- mainWidget->d_func()->createWinId();
- QApplicationPrivate::main_widget = mainWidget;
- if (QApplicationPrivate::main_widget) // give WM command line
- QApplicationPrivate::applyX11SpecificCommandLineArguments(QApplicationPrivate::main_widget);
-}
-#endif
void QApplicationPrivate::applyX11SpecificCommandLineArguments(QWidget *main_widget)
{
case PE_FrameLineEdit:
// fall through
#endif // QT_NO_LINEEDIT
-#ifdef QT3_SUPPORT
- if (widget && widget->inherits("Q3ToolBar")) {
- proxy()->drawPrimitive(PE_Q3Separator, option, painter, widget);
- break;
- }
-#endif
{
QPen oldPen = painter->pen();
if (option->state & State_Enabled) {
QColor textColor(active ? 0xffffff : 0xff000000);
QColor textAlphaColor(active ? 0xffffff : 0xff000000 );
-#ifdef QT3_SUPPORT
- if (widget && widget->inherits("Q3DockWindowTitleBar")) {
- QStyleOptionDockWidgetV2 dockwidget;
- dockwidget.QStyleOption::operator=(*option);
- proxy()->drawControl(CE_DockWidgetTitle, &dockwidget, painter, widget);
- } else
-#endif // QT3_SUPPORT
{
// Fill title bar gradient
QColor titlebarColor = QColor(active ? highlight: palette.background().color());
break;
}
case SH_ComboBox_Popup:
-#ifdef QT3_SUPPORT
- if (widget && widget->inherits("Q3ComboBox"))
- return 0;
-#endif
if (const QStyleOptionComboBox *cmb = qstyleoption_cast<const QStyleOptionComboBox *>(option))
ret = !cmb->editable;
else
}
break;
#endif // QT_NO_PROGRESSBAR
-#ifdef QT3_SUPPORT
- case PE_Q3CheckListController:
-#ifndef QT_NO_IMAGEFORMAT_XPM
- p->drawPixmap(opt->rect.topLeft(), QPixmap(check_list_controller_xpm));
-#endif
- break;
- case PE_Q3CheckListExclusiveIndicator:
- if (const QStyleOptionQ3ListView *lv = qstyleoption_cast<const QStyleOptionQ3ListView *>(opt)) {
- if (lv->items.isEmpty())
- return;
- int x = lv->rect.x(),
- y = lv->rect.y();
-#define INTARRLEN(x) sizeof(x)/(sizeof(int)*2)
- static const int pts1[] = { // dark lines
- 1,9, 1,8, 0,7, 0,4, 1,3, 1,2, 2,1, 3,1, 4,0, 7,0, 8,1, 9,1 };
- static const int pts2[] = { // black lines
- 2,8, 1,7, 1,4, 2,3, 2,2, 3,2, 4,1, 7,1, 8,2, 9,2 };
- static const int pts3[] = { // background lines
- 2,9, 3,9, 4,10, 7,10, 8,9, 9,9, 9,8, 10,7, 10,4, 9,3 };
- static const int pts4[] = { // white lines
- 2,10, 3,10, 4,11, 7,11, 8,10, 9,10, 10,9, 10,8, 11,7,
- 11,4, 10,3, 10,2 };
- // static const int pts5[] = { // inner fill
- // 4,2, 7,2, 9,4, 9,7, 7,9, 4,9, 2,7, 2,4 };
- //QPolygon a;
-
- if (lv->state & State_Enabled)
- p->setPen(lv->palette.text().color());
- else
- p->setPen(QPen(lv->viewportPalette.color(QPalette::Disabled, QPalette::Text)));
- QPolygon a(INTARRLEN(pts1), pts1);
- a.translate(x, y);
- //p->setPen(pal.dark());
- p->drawPolyline(a);
- a.setPoints(INTARRLEN(pts2), pts2);
- a.translate(x, y);
- p->drawPolyline(a);
- a.setPoints(INTARRLEN(pts3), pts3);
- a.translate(x, y);
- // p->setPen(black);
- p->drawPolyline(a);
- a.setPoints(INTARRLEN(pts4), pts4);
- a.translate(x, y);
- // p->setPen(blue);
- p->drawPolyline(a);
- // a.setPoints(INTARRLEN(pts5), pts5);
- // a.translate(x, y);
- // QColor fillColor = isDown() ? g.background() : g.base();
- // p->setPen(fillColor);
- // p->setBrush(fillColor);
- // p->drawPolygon(a);
- if (opt->state & State_On) {
- p->setPen(Qt::NoPen);
- p->setBrush(opt->palette.text());
- p->drawRect(x + 5, y + 4, 2, 4);
- p->drawRect(x + 4, y + 5, 4, 2);
- }
-#undef INTARRLEN
- }
- break;
- case PE_Q3CheckListIndicator:
- if (const QStyleOptionQ3ListView *lv = qstyleoption_cast<const QStyleOptionQ3ListView *>(opt)) {
- if(lv->items.isEmpty())
- break;
- QStyleOptionQ3ListViewItem item = lv->items.at(0);
- int x = lv->rect.x(),
- y = lv->rect.y(),
- w = lv->rect.width(),
- h = lv->rect.width(),
- marg = lv->itemMargin;
-
- if (lv->state & State_Enabled)
- p->setPen(QPen(lv->palette.text().color(), 2));
- else
- p->setPen(QPen(lv->viewportPalette.color(QPalette::Disabled, QPalette::Text), 2));
- if (opt->state & State_Selected && !lv->rootIsDecorated
- && !(item.features & QStyleOptionQ3ListViewItem::ParentControl)) {
- p->fillRect(0, 0, x + marg + w + 4, item.height,
- lv->palette.brush(QPalette::Highlight));
- if (item.state & State_Enabled)
- p->setPen(QPen(lv->palette.highlightedText().color(), 2));
- }
-
- if (lv->state & State_NoChange)
- p->setBrush(lv->palette.brush(QPalette::Button));
- p->drawRect(x + marg, y + 2, w - 4, h - 4);
- /////////////////////
- ++x;
- ++y;
- if (lv->state & State_On || lv->state & State_NoChange) {
- QLineF lines[7];
- int i,
- xx = x + 1 + marg,
- yy = y + 5;
- for (i = 0; i < 3; ++i) {
- lines[i] = QLineF(xx, yy, xx, yy + 2);
- ++xx;
- ++yy;
- }
- yy -= 2;
- for (i = 3; i < 7; ++i) {
- lines[i] = QLineF(xx, yy, xx, yy + 2);
- ++xx;
- --yy;
- }
- p->drawLines(lines, 7);
- }
- }
- break;
-#endif // QT3_SUPPORT
case PE_IndicatorBranch: {
int mid_h = opt->rect.x() + opt->rect.width() / 2;
int mid_v = opt->rect.y() + opt->rect.height() / 2;
if (opt->state & (State_Open | State_Children | State_Item | State_Sibling))
p->drawLine(mid_h, opt->rect.y(), mid_h, bef_v);
break; }
-#ifdef QT3_SUPPORT
- case PE_Q3Separator:
- qDrawShadeLine(p, opt->rect.left(), opt->rect.top(), opt->rect.right(), opt->rect.bottom(),
- opt->palette, opt->state & State_Sunken, 1, 0);
- break;
-#endif // QT3_SUPPORT
case PE_FrameStatusBarItem:
qDrawShadeRect(p, opt->rect, opt->palette, true, 1, 0, 0);
break;
}
break;
#endif // QT_NO_PROGRESSBAR
-#ifdef QT3_SUPPORT
- case SE_Q3DockWindowHandleRect:
- if (const QStyleOptionQ3DockWindow *dw = qstyleoption_cast<const QStyleOptionQ3DockWindow *>(opt)) {
- if (!dw->docked || !dw->closeEnabled)
- r.setRect(0, 0, dw->rect.width(), dw->rect.height());
- else {
- if (dw->state & State_Horizontal)
- r.setRect(0, 15, dw->rect.width(), dw->rect.height() - 15);
- else
- r.setRect(0, 1, dw->rect.width() - 15, dw->rect.height() - 1);
- }
- r = visualRect(opt->direction, opt->rect, r);
- }
- break;
-#endif // QT3_SUPPORT
#ifndef QT_NO_COMBOBOX
case SE_ComboBoxFocusRect:
if (const QStyleOptionComboBox *cb = qstyleoption_cast<const QStyleOptionComboBox *>(opt)) {
}
break;
#endif // QT_NO_SCROLLBAR
-#ifdef QT3_SUPPORT
- case CC_Q3ListView:
- if (const QStyleOptionQ3ListView *lv = qstyleoption_cast<const QStyleOptionQ3ListView *>(opt)) {
- if (lv->subControls & SC_Q3ListView)
- p->fillRect(lv->rect, lv->viewportPalette.brush(lv->viewportBGRole));
- }
- break;
-#endif // QT3_SUPPORT
#ifndef QT_NO_SPINBOX
case CC_SpinBox:
if (const QStyleOptionSpinBox *sb = qstyleoption_cast<const QStyleOptionSpinBox *>(opt)) {
}
break;
#endif // QT_NO_TOOLBUTTON
-#ifdef QT3_SUPPORT
- case CC_Q3ListView:
- if (const QStyleOptionQ3ListView *lv = qstyleoption_cast<const QStyleOptionQ3ListView *>(opt)) {
- if (pt.x() >= 0 && pt.x() < lv->treeStepSize)
- sc = SC_Q3ListViewExpand;
- }
- break;
-#endif // QT3_SUPPORT
#ifndef QT_NO_SPINBOX
case CC_SpinBox:
if (const QStyleOptionSpinBox *spinbox = qstyleoption_cast<const QStyleOptionSpinBox *>(opt)) {
ret = QEvent::MouseButtonPress;
break;
-#ifdef QT3_SUPPORT
- case SH_GUIStyle:
- ret = Qt::WindowsStyle;
- break;
-#endif
case SH_TabBar_Alignment:
case SH_Header_ArrowAlignment:
static FocusRectPolicy focusRectPolicy(const QWidget *w);
enum WidgetSizePolicy { SizeSmall, SizeLarge, SizeMini, SizeDefault
-#ifdef QT3_SUPPORT
- , SizeNone = SizeDefault
-#endif
};
static void setWidgetSizePolicy(const QWidget *w, WidgetSizePolicy policy);
static WidgetSizePolicy widgetSizePolicy(const QWidget *w);
int ret;
switch (hint) {
-#ifdef QT3_SUPPORT
- case SH_GUIStyle:
- ret = Qt::MotifStyle;
- break;
-#endif
case SH_DrawMenuBarSeparator:
ret = true;
break;
painter->setPen(oldPen);
break;
}
-#ifdef QT3_SUPPORT
- case PE_Q3DockWindowSeparator: {
- QPen oldPen = painter->pen();
- painter->setPen(alphaCornerColor);
- QRect rect = option->rect;
- if (option->state & State_Horizontal) {
- painter->drawLine(rect.right(), rect.top() + 2, rect.right(), rect.bottom() - 1);
- } else {
- painter->drawLine(rect.left() + 2, rect.bottom(), rect.right() - 1, rect.bottom());
- }
- painter->setPen(oldPen);
- break;
- }
- case PE_Q3Separator: {
- QPen oldPen = painter->pen();
- painter->setPen(alphaCornerColor);
- if ((option->state & State_Horizontal) == 0)
- painter->drawLine(option->rect.bottomLeft(), option->rect.bottomRight());
- else
- painter->drawLine(option->rect.topRight(), option->rect.bottomRight());
- painter->setPen(option->palette.background().color().lighter(104));
- if ((option->state & State_Horizontal) == 0)
- painter->drawLine(option->rect.topLeft(), option->rect.topRight());
- else
- painter->drawLine(option->rect.topLeft(), option->rect.bottomLeft());
- painter->setPen(oldPen);
- break;
- }
-#endif // QT3_SUPPORT
#ifndef QT_NO_MAINWINDOW
case PE_PanelMenuBar:
if ((widget && qobject_cast<const QMainWindow *>(widget->parentWidget()))
-#ifdef QT3_SUPPORT
- || (widget && widget->parentWidget() && widget->parentWidget()->inherits("Q3MainWindow"))
-#endif
) {
// Draws the light line above and the dark line below menu bars and
// tool bars.
case PE_IndicatorToolBarHandle: {
QPixmap cache;
QRect rect = option->rect;
-#ifdef QT3_SUPPORT
- if (widget && widget->inherits("Q3DockWindowHandle") && widget->parentWidget()->inherits("Q3DockWindow")) {
- if (!(option->state & State_Horizontal))
- rect.adjust(2, 0, -2, 0);
- }
-#endif
QString pixmapName = QStyleHelper::uniqueName(QLatin1String("toolbarhandle"), option, rect.size());
if (!QPixmapCache::find(pixmapName, cache)) {
cache = QPixmap(rect.size());
points[1] = QPoint(option->rect.right() - 1, option->rect.bottom() - 1);
painter->drawPoints(points, 2);
-#ifdef QT3_SUPPORT
- if (widget && widget->inherits("Q3DockWindow")) {
- // also draw the frame on the title bar
- lines[0] = QLine(option->rect.left() + 1, option->rect.top(),
- option->rect.right() - 1, option->rect.top());
- lines[1] = QLine(option->rect.left(), option->rect.top() + 1,
- option->rect.left(), titleBarStop);
- lines[2] = QLine(option->rect.right(), option->rect.top() + 1,
- option->rect.right(), titleBarStop);
- painter->drawLines(lines, 3);
- }
-#endif
// alpha corners
painter->setPen(mergedColors(palette.highlight().color(), palette.background().color(), 55));
points[3] = QPoint(option->rect.right() - 1, option->rect.bottom() - 2);
painter->drawPoints(points, 4);
-#ifdef QT3_SUPPORT
- if (widget && widget->inherits("Q3DockWindow")) {
- // also draw the frame on the title bar
- points[0] = option->rect.topLeft();
- points[1] = option->rect.topRight();
- painter->drawPoints(points, 2);
- }
-#endif
// upper and lower left inner
painter->setPen(active ? mergedColors(palette.highlight().color(), palette.background().color()) : palette.background().color().darker(120));
painter->drawLine(option->rect.left() + 1, titleBarStop, option->rect.left() + 1, option->rect.bottom() - 2);
-#ifdef QT3_SUPPORT
- if (widget && widget->inherits("Q3DockWindow")) {
- // also draw the frame on the title bar
- lines[0] = QLine(option->rect.left() + 1, option->rect.top() + 1,
- option->rect.left() + 1, titleBarStop);
- lines[1] = QLine(option->rect.right() - 1, option->rect.top() + 1,
- option->rect.right() - 1, titleBarStop);
- lines[2] = QLine(option->rect.left() + 1, option->rect.top() + 1,
- option->rect.right() - 1, option->rect.top() + 1);
- painter->drawLines(lines, 3);
- }
-#endif
painter->setPen(active ? mergedColors(palette.highlight().color(), palette.background().color(), 57) : palette.background().color().darker(130));
lines[0] = QLine(option->rect.right() - 1, titleBarStop, option->rect.right() - 1, option->rect.bottom() - 2);
if (title.isEmpty()) {
// Joint handle if there's no title
QRect r;
-#ifdef QT3_SUPPORT
- // Q3DockWindow doesn't need space for buttons
- if (widget && widget->inherits("Q3DockWindowTitleBar")) {
- r = rect;
- } else
-#endif
r.setRect(titleRect.left(), titleRect.top(), titleRect.width(), titleRect.bottom());
int nchunks = (r.width() / handle.width()) - 1;
int indent = (r.width() - (nchunks * handle.width())) / 2;
QColor textColor(active ? 0x282e40 : 0x282e40);
QColor textAlphaColor(active ? 0x3f4862 : 0x3f4862);
-#ifdef QT3_SUPPORT
- if (widget && widget->inherits("Q3DockWindowTitleBar")) {
- QStyleOptionDockWidgetV2 dockwidget;
- dockwidget.QStyleOption::operator=(*option);
- dockwidget.title = titleBar->text;
- proxy()->drawControl(CE_DockWidgetTitle, &dockwidget, painter, widget);
- } else
-#endif // QT3_SUPPORT
{
// Fill title bar gradient
ret = 4;
break;
case PM_TitleBarHeight:
-#ifdef QT3_SUPPORT
- if (widget && widget->inherits("Q3DockWindowTitleBar")) {
- // Q3DockWindow has smaller title bars than QDockWidget
- ret = qMax(widget->fontMetrics().height(), 20);
- } else
-#endif
ret = qMax(widget ? widget->fontMetrics().height() :
(option ? option->fontMetrics.height() : 0), 30);
break;
#ifndef QT_NO_MENUBAR
|| qobject_cast<QMenuBar *>(widget)
#endif
-#ifdef QT3_SUPPORT
- || widget->inherits("Q3ToolBar")
-#endif
#ifndef QT_NO_TOOLBAR
|| qobject_cast<QToolBar *>(widget)
|| (widget && qobject_cast<QToolBar *>(widget->parent()))
#ifndef QT_NO_TOOLBOX
|| qobject_cast<QToolBox *>(widget)
#endif
-#ifdef QT3_SUPPORT
- || widget->inherits("Q3ToolBar")
-#endif
#ifndef QT_NO_TOOLBAR
|| qobject_cast<QToolBar *>(widget)
|| (widget && qobject_cast<QToolBar *>(widget->parent()))
enum StateFlag {
State_None = 0x00000000,
-#ifdef QT3_SUPPORT
- State_Default = State_None,
-#endif
State_Enabled = 0x00000001,
State_Raised = 0x00000002,
State_Sunken = 0x00000004,
};
Q_DECLARE_FLAGS(State, StateFlag)
-#ifdef QT3_SUPPORT
- typedef State SFlags;
-#endif
enum PrimitiveElement {
PE_Q3CheckListController,
};
Q_DECLARE_FLAGS(SubControls, SubControl)
-#ifdef QT3_SUPPORT
- typedef SubControls SCFlags;
-#endif
virtual void drawComplexControl(ComplexControl cc, const QStyleOptionComplex *opt, QPainter *p,
const QWidget *widget = 0) const = 0;
SH_RequestSoftwareInputPanel,
// Add new style hint values here
-#ifdef QT3_SUPPORT
- SH_GUIStyle = 0x00000100,
- SH_ScrollBar_BackgroundMode,
- // Add other compat values here
-
- SH_UnderlineAccelerator = SH_UnderlineShortcut,
-#endif
SH_CustomBase = 0xf0000000
};
if (w->data->fnt == font)
return;
-#ifdef QT3_SUPPORT
- QFont old = w->data->fnt;
-#endif
w->data->fnt = font;
#if defined(Q_WS_X11)
// make sure the font set on this widget is associated with the correct screen
QEvent e(QEvent::FontChange);
QApplication::sendEvent(w, &e);
-#ifdef QT3_SUPPORT
- w->fontChange(old);
-#endif
}
void QStyleSheetStyle::saveWidgetFont(QWidget* w, const QFont& font) const
#if defined(Q_WS_WIN)
case PM_TitleBarHeight:
-#ifdef QT3_SUPPORT
- // qt3 dockwindow height should be equal to tool windows
- if (widget && widget->inherits("Q3DockWindowTitleBar")) {
- ret = GetSystemMetrics(SM_CYSMCAPTION) - 1;
- } else
-#endif
if (widget && (widget->windowType() == Qt::Tool)) {
// MS always use one less than they say
#if defined(Q_OS_WINCE)
return r;
}
-#ifdef QT3_SUPPORT
-Q_GLOBAL_STATIC_WITH_ARGS(QBitmap, globalVerticalLine, (1, 129))
-Q_GLOBAL_STATIC_WITH_ARGS(QBitmap, globalHorizontalLine, (128, 1))
-#endif
/*! \reimp */
void QWindowsStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComplex *opt,
}
break;
#endif // QT_NO_SCROLLBAR
-#ifdef QT3_SUPPORT
- case CC_Q3ListView:
- if (const QStyleOptionQ3ListView *lv = qstyleoption_cast<const QStyleOptionQ3ListView *>(opt)) {
- int i;
- if (lv->subControls & SC_Q3ListView)
- QCommonStyle::drawComplexControl(cc, lv, p, widget);
- if (lv->subControls & (SC_Q3ListViewBranch | SC_Q3ListViewExpand)) {
- if (lv->items.isEmpty())
- break;
- QStyleOptionQ3ListViewItem item = lv->items.at(0);
- int y = lv->rect.y();
- int c;
- int dotoffset = 0;
- QPolygon dotlines;
- if ((lv->activeSubControls & SC_All) && (lv->subControls & SC_Q3ListViewExpand)) {
- c = 2;
- dotlines.resize(2);
- dotlines[0] = QPoint(lv->rect.right(), lv->rect.top());
- dotlines[1] = QPoint(lv->rect.right(), lv->rect.bottom());
- } else {
- int linetop = 0, linebot = 0;
- // each branch needs at most two lines, ie. four end points
- dotoffset = (item.itemY + item.height - y) % 2;
- dotlines.resize(item.childCount * 4);
- c = 0;
-
- // skip the stuff above the exposed rectangle
- for (i = 1; i < lv->items.size(); ++i) {
- QStyleOptionQ3ListViewItem child = lv->items.at(i);
- if (child.height + y > 0)
- break;
- y += child.totalHeight;
- }
- int bx = lv->rect.width() / 2;
-
- // paint stuff in the magical area
- while (i < lv->items.size() && y < lv->rect.height()) {
- QStyleOptionQ3ListViewItem child = lv->items.at(i);
- if (child.features & QStyleOptionQ3ListViewItem::Visible) {
- int lh;
- if (!(item.features & QStyleOptionQ3ListViewItem::MultiLine))
- lh = child.height;
- else
- lh = p->fontMetrics().height() + 2 * lv->itemMargin;
- lh = qMax(lh, QApplication::globalStrut().height());
- if (lh % 2 > 0)
- ++lh;
- linebot = y + lh / 2;
- if (child.features & QStyleOptionQ3ListViewItem::Expandable
- || (child.childCount > 0 && child.height > 0)) {
- // needs a box
- p->setPen(lv->palette.mid().color());
- p->drawRect(bx - 4, linebot - 4, 8, 8);
- // plus or minus
- p->setPen(lv->palette.text().color());
- p->drawLine(bx - 2, linebot, bx + 2, linebot);
- if (!(child.state & State_Open))
- p->drawLine(bx, linebot - 2, bx, linebot + 2);
- // dotlinery
- p->setPen(lv->palette.mid().color());
- dotlines[c++] = QPoint(bx, linetop);
- dotlines[c++] = QPoint(bx, linebot - 4);
- dotlines[c++] = QPoint(bx + 5, linebot);
- dotlines[c++] = QPoint(lv->rect.width(), linebot);
- linetop = linebot + 5;
- } else {
- // just dotlinery
- dotlines[c++] = QPoint(bx+1, linebot -1);
- dotlines[c++] = QPoint(lv->rect.width(), linebot -1);
- }
- y += child.totalHeight;
- }
- ++i;
- }
-
- // Expand line height to edge of rectangle if there's any
- // visible child below
- while (i < lv->items.size() && lv->items.at(i).height <= 0)
- ++i;
- if (i < lv->items.size())
- linebot = lv->rect.height();
-
- if (linetop < linebot) {
- dotlines[c++] = QPoint(bx, linetop);
- dotlines[c++] = QPoint(bx, linebot);
- }
- }
- p->setPen(lv->palette.text().color());
- QBitmap *verticalLine = globalVerticalLine();
- QBitmap *horizontalLine = globalHorizontalLine();
- static bool isInit = false;
- if (!isInit) {
- isInit = true;
- // make 128*1 and 1*128 bitmaps that can be used for
- // drawing the right sort of lines.
- verticalLine->clear();
- horizontalLine->clear();
- QPolygon a(64);
- QPainter p;
- p.begin(verticalLine);
- for(i = 0; i < 64; ++i)
- a.setPoint(i, 0, i * 2 + 1);
- p.setPen(Qt::color1);
- p.drawPoints(a);
- p.end();
- QApplication::flush();
- verticalLine->setMask(*verticalLine);
- p.begin(horizontalLine);
- for(i = 0; i < 64; ++i)
- a.setPoint(i, i * 2 + 1, 0);
- p.setPen(Qt::color1);
- p.drawPoints(a);
- p.end();
- QApplication::flush();
- horizontalLine->setMask(*horizontalLine);
- }
-
- int line; // index into dotlines
- if (lv->subControls & SC_Q3ListViewBranch) for(line = 0; line < c; line += 2) {
- // assumptions here: lines are horizontal or vertical.
- // lines always start with the numerically lowest
- // coordinate.
-
- // point ... relevant coordinate of current point
- // end ..... same coordinate of the end of the current line
- // other ... the other coordinate of the current point/line
- if (dotlines[line].y() == dotlines[line+1].y()) {
- int end = dotlines[line + 1].x();
- int point = dotlines[line].x();
- int other = dotlines[line].y();
- while (point < end) {
- int i = 128;
- if (i + point > end)
- i = end-point;
- p->drawPixmap(point, other, *horizontalLine, 0, 0, i, 1);
- point += i;
- }
- } else {
- int end = dotlines[line + 1].y();
- int point = dotlines[line].y();
- int other = dotlines[line].x();
- int pixmapoffset = ((point & 1) != dotoffset) ? 1 : 0;
- while(point < end) {
- int i = 128;
- if (i + point > end)
- i = end-point;
- p->drawPixmap(other, point, *verticalLine, 0, pixmapoffset, 1, i);
- point += i;
- }
- }
- }
- }
- }
- break;
-#endif // QT3_SUPPORT
#ifndef QT_NO_COMBOBOX
case CC_ComboBox:
if (const QStyleOptionComboBox *cmb = qstyleoption_cast<const QStyleOptionComboBox *>(opt)) {
XPThemeData theme(widget, p, QLatin1String("WINDOW"));
if (sub & SC_TitleBarLabel) {
-#ifdef QT3_SUPPORT
- if (widget && widget->inherits("Q3DockWindowTitleBar")) {
- partId = WP_SMALLCAPTION;
- } else
-#endif
partId = (tb->titleBarState & Qt::WindowMinimized) ? WP_MINCAPTION : WP_CAPTION;
theme.rect = option->rect;
if (widget && !widget->isEnabled())
case PM_TitleBarHeight:
{
-#ifdef QT3_SUPPORT
- if (widget && widget->inherits("Q3DockWindowTitleBar")) {
- res = GetSystemMetrics(SM_CYSMCAPTION) + GetSystemMetrics(SM_CXSIZEFRAME);
- } else
-#endif
if (widget && (widget->windowType() == Qt::Tool))
res = GetSystemMetrics(SM_CYSMCAPTION) + GetSystemMetrics(SM_CXSIZEFRAME);
else
}
-#ifdef QT3_SUPPORT
-/*!
- Use icon() instead.
-*/
-QIcon *QAbstractButton::iconSet() const
-{
- Q_D(const QAbstractButton);
- if (!d->icon.isNull())
- return const_cast<QIcon *>(&d->icon);
- return 0;
-}
-
-/*!
- Use QAbstractButton(QWidget *) instead.
-
- Call setObjectName() if you want to specify an object name, and
- setParent() if you want to set the window flags.
-*/
-QAbstractButton::QAbstractButton(QWidget *parent, const char *name, Qt::WindowFlags f)
- : QWidget(*new QAbstractButtonPrivate, parent, f)
-{
- Q_D(QAbstractButton);
- setObjectName(QString::fromAscii(name));
- d->init();
-}
-
-/*! \fn bool QAbstractButton::isOn() const
-
- Use isChecked() instead.
-*/
-
-/*!
- \fn QPixmap *QAbstractButton::pixmap() const
-
- This compatibility function always returns 0.
-
- Use icon() instead.
-*/
-
-/*! \fn void QAbstractButton::setPixmap(const QPixmap &p)
-
- Use setIcon() instead.
-*/
-
-/*! \fn void QAbstractButton::setIconSet(const QIcon &icon)
-
- Use setIcon() instead.
-*/
-
-/*! \fn void QAbstractButton::setOn(bool b)
-
- Use setChecked() instead.
-*/
-
-/*! \fn bool QAbstractButton::isToggleButton() const
-
- Use isCheckable() instead.
-*/
-
-/*!
- \fn void QAbstractButton::setToggleButton(bool b)
-
- Use setCheckable() instead.
-*/
-
-/*! \fn void QAbstractButton::setAccel(const QKeySequence &key)
-
- Use setShortcut() instead.
-*/
-
-/*! \fn QKeySequence QAbstractButton::accel() const
-
- Use shortcut() instead.
-*/
-#endif
QT_END_NAMESPACE
void changeEvent(QEvent *e);
void timerEvent(QTimerEvent *e);
-#ifdef QT3_SUPPORT
-public:
- QT3_SUPPORT_CONSTRUCTOR QAbstractButton(QWidget *parent, const char *name, Qt::WindowFlags f=0);
- inline QT3_SUPPORT bool isOn() const { return isChecked(); }
- inline QT3_SUPPORT const QPixmap *pixmap() const { return 0; } // help styles compile
- inline QT3_SUPPORT void setPixmap( const QPixmap &p ) {
- setIcon(QIcon(p));
- setIconSize(p.size());
- }
- QT3_SUPPORT QIcon *iconSet() const;
- inline QT3_SUPPORT void setIconSet(const QIcon &icon) { setIcon(icon); }
- inline QT3_SUPPORT bool isToggleButton() const { return isCheckable(); }
- inline QT3_SUPPORT void setToggleButton(bool b) { setCheckable(b); }
- inline QT3_SUPPORT void setAccel(const QKeySequence &key) { setShortcut(key); }
- inline QT3_SUPPORT QKeySequence accel() const { return shortcut(); }
-
-public Q_SLOTS:
- inline QT_MOC_COMPAT void setOn(bool b) { setChecked(b); }
-#endif
protected:
QAbstractButton(QAbstractButtonPrivate &dd, QWidget* parent = 0);
#endif
void changeEvent(QEvent *e);
-#ifdef QT3_SUPPORT
-public:
- inline QT3_SUPPORT int minValue() const { return minimum(); }
- inline QT3_SUPPORT int maxValue() const { return maximum(); }
- inline QT3_SUPPORT int lineStep() const { return singleStep(); }
- inline QT3_SUPPORT void setMinValue(int v) { setMinimum(v); }
- inline QT3_SUPPORT void setMaxValue(int v) { setMaximum(v); }
- inline QT3_SUPPORT void setLineStep(int v) { setSingleStep(v); }
- inline QT3_SUPPORT void setSteps(int single, int page) { setSingleStep(single); setPageStep(page); }
- inline QT3_SUPPORT void addPage() { triggerAction(SliderPageStepAdd); }
- inline QT3_SUPPORT void subtractPage() { triggerAction(SliderPageStepSub); }
- inline QT3_SUPPORT void addLine() { triggerAction(SliderSingleStepAdd); }
- inline QT3_SUPPORT void subtractLine() { triggerAction(SliderSingleStepSub); }
-#endif
protected:
QAbstractSlider(QAbstractSliderPrivate &dd, QWidget *parent=0);
void buttonReleased(QAbstractButton *);
void buttonReleased(int);
-#ifdef QT3_SUPPORT
-public:
- inline QT3_SUPPORT void insert(QAbstractButton *b) { addButton(b); }
- inline QT3_SUPPORT void remove(QAbstractButton *b) { removeButton(b); }
-#endif
private:
Q_DISABLE_COPY(QButtonGroup)
return QAbstractButton::event(e);
}
-#ifdef QT3_SUPPORT
-/*!
- Use one of the constructors that doesn't take the \a name
- argument and then use setObjectName() instead.
-*/
-QCheckBox::QCheckBox(QWidget *parent, const char* name)
- : QAbstractButton (*new QCheckBoxPrivate, parent)
-{
- Q_D(QCheckBox);
- setObjectName(QString::fromAscii(name));
- d->init();
-}
-
-/*!
- Use one of the constructors that doesn't take the \a name
- argument and then use setObjectName() instead.
-*/
-QCheckBox::QCheckBox(const QString &text, QWidget *parent, const char* name)
- : QAbstractButton (*new QCheckBoxPrivate, parent)
-{
- Q_D(QCheckBox);
- setObjectName(QString::fromAscii(name));
- d->init();
- setText(text);
-}
-
-#endif
QT_END_NAMESPACE
void mouseMoveEvent(QMouseEvent *);
void initStyleOption(QStyleOptionButton *option) const;
-#ifdef QT3_SUPPORT
-public:
- enum ToggleState {
- Off = Qt::Unchecked,
- NoChange = Qt::PartiallyChecked,
- On = Qt::Checked
- };
- inline QT3_SUPPORT ToggleState state() const
- { return static_cast<QCheckBox::ToggleState>(static_cast<int>(checkState())); }
- inline QT3_SUPPORT void setState(ToggleState state)
- { setCheckState(static_cast<Qt::CheckState>(static_cast<int>(state))); }
- inline QT3_SUPPORT void setNoChange()
- { setCheckState(Qt::PartiallyChecked); }
- QT3_SUPPORT_CONSTRUCTOR QCheckBox(QWidget *parent, const char* name);
- QT3_SUPPORT_CONSTRUCTOR QCheckBox(const QString &text, QWidget *parent, const char* name);
-#endif
private:
Q_DECLARE_PRIVATE(QCheckBox)
d->init();
}
-#ifdef QT3_SUPPORT
-/*!
- Use one of the constructors that doesn't take the \a name
- argument and then use setObjectName() instead.
-*/
-QComboBox::QComboBox(QWidget *parent, const char *name)
- : QWidget(*new QComboBoxPrivate(), parent, 0)
-{
- Q_D(QComboBox);
- d->init();
- setObjectName(QString::fromAscii(name));
-}
-
-/*!
- Use one of the constructors that doesn't take the \a name
- argument and then use setObjectName() instead.
-*/
-QComboBox::QComboBox(bool rw, QWidget *parent, const char *name)
- : QWidget(*new QComboBoxPrivate(), parent, 0)
-{
- Q_D(QComboBox);
- d->init();
- setEditable(rw);
- setObjectName(QString::fromAscii(name));
-}
-
-#endif //QT3_SUPPORT
/*!
\class QComboBox
connect(d->lineEdit, SIGNAL(returnPressed()), this, SLOT(_q_returnPressed()));
connect(d->lineEdit, SIGNAL(editingFinished()), this, SLOT(_q_editingFinished()));
connect(d->lineEdit, SIGNAL(textChanged(QString)), this, SIGNAL(editTextChanged(QString)));
-#ifdef QT3_SUPPORT
- connect(d->lineEdit, SIGNAL(textChanged(QString)), this, SIGNAL(textChanged(QString)));
-#endif
d->lineEdit->setFrame(false);
d->lineEdit->setContextMenuPolicy(Qt::NoContextMenu);
d->lineEdit->setFocusProxy(this);
BeforeCurrent = InsertBeforeCurrent
#endif
};
-#ifdef QT3_SUPPORT
- typedef InsertPolicy Policy;
-#endif
InsertPolicy insertPolicy() const;
void setInsertPolicy(InsertPolicy policy);
QVariant inputMethodQuery(Qt::InputMethodQuery) const;
void initStyleOption(QStyleOptionComboBox *option) const;
-#ifdef QT3_SUPPORT
-public:
- QT3_SUPPORT_CONSTRUCTOR QComboBox(QWidget *parent, const char *name);
- QT3_SUPPORT_CONSTRUCTOR QComboBox(bool rw, QWidget *parent, const char *name = 0);
- inline QT3_SUPPORT int currentItem() const { return currentIndex(); }
- inline QT3_SUPPORT void setCurrentItem(int index) { setCurrentIndex(index); }
- inline QT3_SUPPORT InsertPolicy insertionPolicy() const { return insertPolicy(); }
- inline QT3_SUPPORT void setInsertionPolicy(InsertPolicy policy) { setInsertPolicy(policy); }
- inline QT3_SUPPORT bool editable() const { return isEditable(); }
- inline QT3_SUPPORT void popup() { showPopup(); }
- inline QT3_SUPPORT void setCurrentText(const QString& text) {
- int i = findText(text);
- if (i != -1)
- setCurrentIndex(i);
- else if (isEditable())
- setEditText(text);
- else
- setItemText(currentIndex(), text);
- }
- inline QT3_SUPPORT QString text(int index) const { return itemText(index); }
-
- inline QT3_SUPPORT QPixmap pixmap(int index) const
- { return itemIcon(index).pixmap(iconSize(), isEnabled() ? QIcon::Normal : QIcon::Disabled); }
- inline QT3_SUPPORT void insertStringList(const QStringList &list, int index = -1)
- { insertItems((index < 0 ? count() : index), list); }
- inline QT3_SUPPORT void insertItem(const QString &text, int index = -1)
- { insertItem((index < 0 ? count() : index), text); }
- inline QT3_SUPPORT void insertItem(const QPixmap &pix, int index = -1)
- { insertItem((index < 0 ? count() : index), QIcon(pix), QString()); }
- inline QT3_SUPPORT void insertItem(const QPixmap &pix, const QString &text, int index = -1)
- { insertItem((index < 0 ? count() : index), QIcon(pix), text); }
- inline QT3_SUPPORT void changeItem(const QString &text, int index)
- { setItemText(index, text); }
- inline QT3_SUPPORT void changeItem(const QPixmap &pix, int index)
- { setItemIcon(index, QIcon(pix)); }
- inline QT3_SUPPORT void changeItem(const QPixmap &pix, const QString &text, int index)
- { setItemIcon(index, QIcon(pix)); setItemText(index, text); }
- inline QT3_SUPPORT void clearValidator() { setValidator(0); }
- inline QT3_SUPPORT void clearEdit() { clearEditText(); }
-
-Q_SIGNALS:
- QT_MOC_COMPAT void textChanged(const QString &);
-#endif
protected:
QComboBox(QComboBoxPrivate &, QWidget *);
Q_Q(QDial);
showNotches = false;
q->setFocusPolicy(Qt::WheelFocus);
-#ifdef QT3_SUPPORT
- QObject::connect(q, SIGNAL(sliderPressed()), q, SIGNAL(dialPressed()));
- QObject::connect(q, SIGNAL(sliderMoved(int)), q, SIGNAL(dialMoved(int)));
- QObject::connect(q, SIGNAL(sliderReleased()), q, SIGNAL(dialReleased()));
-#endif
}
int QDialPrivate::bound(int val) const
d->init();
}
-#ifdef QT3_SUPPORT
-/*!
- Use one of the constructors that doesn't take the \a name
- argument and then use setObjectName() instead.
-*/
-QDial::QDial(QWidget *parent, const char *name)
- : QAbstractSlider(*new QDialPrivate, parent)
-{
- Q_D(QDial);
- setObjectName(QString::fromAscii(name));
- d->init();
-}
-
-/*!
- Use one of the constructors that doesn't take the \a name
- argument and then use setObjectName() instead.
-*/
-QDial::QDial(int minValue, int maxValue, int pageStep, int value,
- QWidget *parent, const char *name)
- : QAbstractSlider(*new QDialPrivate, parent)
-{
- Q_D(QDial);
- setObjectName(QString::fromAscii(name));
- d->minimum = minValue;
- d->maximum = maxValue;
- d->pageStep = pageStep;
- d->position = d->value = value;
- d->init();
-}
-#endif
/*!
Destroys the dial.
*/
void sliderChange(SliderChange change);
void initStyleOption(QStyleOptionSlider *option) const;
-#ifdef QT3_SUPPORT
-public:
- QT3_SUPPORT_CONSTRUCTOR QDial(int minValue, int maxValue, int pageStep, int value,
- QWidget* parent = 0, const char* name = 0);
- QT3_SUPPORT_CONSTRUCTOR QDial(QWidget *parent, const char *name);
-
-Q_SIGNALS:
- QT_MOC_COMPAT void dialPressed();
- QT_MOC_COMPAT void dialMoved(int value);
- QT_MOC_COMPAT void dialReleased();
-#endif
private:
Q_DECLARE_PRIVATE(QDial)
d->init();
}
-#ifdef QT3_SUPPORT
-/*!
- Use one of the constructors that doesn't take the \a name
- argument and then use setObjectName() instead.
-*/
-QFrame::QFrame(QWidget *parent, const char *name, Qt::WindowFlags f)
- : QWidget(*new QFramePrivate, parent, f)
-{
- Q_D(QFrame);
- setObjectName(QString::fromAscii(name));
- d->init();
-}
-#endif
/*!
Destroys the frame.
void changeEvent(QEvent *);
void drawFrame(QPainter *);
-#ifdef QT3_SUPPORT
-public:
- QT3_SUPPORT_CONSTRUCTOR QFrame(QWidget* parent, const char* name, Qt::WindowFlags f = 0);
-#endif
protected:
QFrame(QFramePrivate &dd, QWidget* parent = 0, Qt::WindowFlags f = 0);
update(style()->subControlRect(QStyle::CC_GroupBox, &box, QStyle::SC_GroupBoxCheckBox, this));
}
-#ifdef QT3_SUPPORT
-/*!
- Use one of the constructors that doesn't take the \a name
- argument and then use setObjectName() instead.
-*/
-QGroupBox::QGroupBox(QWidget *parent, const char *name)
- : QWidget(*new QGroupBoxPrivate, parent, 0)
-{
- Q_D(QGroupBox);
- setObjectName(QString::fromAscii(name));
- d->init();
-}
-
-/*!
- Use one of the constructors that doesn't take the \a name
- argument and then use setObjectName() instead.
-*/
-QGroupBox::QGroupBox(const QString &title, QWidget *parent, const char *name)
- : QWidget(*new QGroupBoxPrivate, parent, 0)
-{
- Q_D(QGroupBox);
- setObjectName(QString::fromAscii(name));
- d->init();
- setTitle(title);
-}
-#endif // QT3_SUPPORT
QT_END_NAMESPACE
void mouseReleaseEvent(QMouseEvent *event);
void initStyleOption(QStyleOptionGroupBox *option) const;
-#ifdef QT3_SUPPORT
-public:
- QT3_SUPPORT_CONSTRUCTOR QGroupBox(QWidget* parent, const char* name);
- QT3_SUPPORT_CONSTRUCTOR QGroupBox(const QString &title, QWidget* parent, const char* name);
-#endif
private:
Q_DISABLE_COPY(QGroupBox)
}
-#ifdef QT3_SUPPORT
-/*! \obsolete
- Constructs an empty label.
-
- The \a parent, \a name and widget flag \a f, arguments are passed
- to the QFrame constructor.
-
- \sa setAlignment(), setFrameStyle(), setIndent()
-*/
-
-QLabel::QLabel(QWidget *parent, const char *name, Qt::WindowFlags f)
- : QFrame(*new QLabelPrivate(), parent, f)
-{
- Q_D(QLabel);
- if (name)
- setObjectName(QString::fromAscii(name));
- d->init();
-}
-
-
-/*! \obsolete
- Constructs a label that displays the text, \a text.
-
- The \a parent, \a name and widget flag \a f, arguments are passed
- to the QFrame constructor.
-
- \sa setText(), setAlignment(), setFrameStyle(), setIndent()
-*/
-
-QLabel::QLabel(const QString &text, QWidget *parent, const char *name,
- Qt::WindowFlags f)
- : QFrame(*new QLabelPrivate(), parent, f)
-{
- Q_D(QLabel);
- if (name)
- setObjectName(QString::fromAscii(name));
- d->init();
- setText(text);
-}
-
-
-/*! \obsolete
- Constructs a label that displays the text \a text. The label has a
- buddy widget, \a buddy.
-
- If the \a text contains an underlined letter (a letter preceded by
- an ampersand, \&), when the user presses Alt+ the underlined letter,
- focus is passed to the buddy widget.
-
- The \a parent, \a name and widget flag, \a f, arguments are passed
- to the QFrame constructor.
-
- \sa setText(), setBuddy(), setAlignment(), setFrameStyle(),
- setIndent()
-*/
-QLabel::QLabel(QWidget *buddy, const QString &text,
- QWidget *parent, const char *name, Qt::WindowFlags f)
- : QFrame(*new QLabelPrivate(), parent, f)
-{
- Q_D(QLabel);
- if (name)
- setObjectName(QString::fromAscii(name));
- d->init();
-#ifndef QT_NO_SHORTCUT
- setBuddy(buddy);
-#endif
- setText(text);
-}
-#endif //QT3_SUPPORT
/*!
Destroys the label.
d->updateLabel();
}
-#ifdef QT3_SUPPORT
-/*!
- Use setAlignment(Qt::Alignment) instead.
-
- If \a alignment specifies text flags as well, use setTextFormat()
- to set those.
-*/
-void QLabel::setAlignment(int alignment)
-{
- Q_D(QLabel);
- d->align = alignment & ~(Qt::AlignVertical_Mask|Qt::AlignHorizontal_Mask|Qt::TextWordWrap);
- setAlignment(Qt::Alignment(QFlag(alignment)));
-}
-#endif
Qt::Alignment QLabel::alignment() const
{
void focusOutEvent(QFocusEvent *ev);
bool focusNextPrevChild(bool next);
-#ifdef QT3_SUPPORT
-public:
- QT3_SUPPORT_CONSTRUCTOR QLabel(QWidget *parent, const char* name, Qt::WindowFlags f=0);
- QT3_SUPPORT_CONSTRUCTOR QLabel(const QString &text, QWidget *parent, const char* name,
- Qt::WindowFlags f=0);
- QT3_SUPPORT_CONSTRUCTOR QLabel(QWidget *buddy, const QString &,
- QWidget *parent=0, const char* name=0, Qt::WindowFlags f=0);
- QT3_SUPPORT void setAlignment(int alignment);
-
- // don't mark the next function with QT3_SUPPORT
- inline void setAlignment(Qt::AlignmentFlag flag) { setAlignment((Qt::Alignment)flag); }
-#endif
private:
Q_DISABLE_COPY(QLabel)
}
-#ifdef QT3_SUPPORT
-/*! \obsolete
- Constructs an LCD number, sets the number of digits to 5, the base
- to decimal, the decimal point mode to 'small' and the frame style
- to a raised box. The segmentStyle() is set to \c Outline.
-
- The \a parent and \a name arguments are passed to the QFrame
- constructor.
-
- \sa setDigitCount(), setSmallDecimalPoint()
-*/
-
-QLCDNumber::QLCDNumber(QWidget *parent, const char *name)
- : QFrame(*new QLCDNumberPrivate, parent)
-{
- setObjectName(QString::fromAscii(name));
- Q_D(QLCDNumber);
- d->ndigits = 5;
- d->init();
-}
-
-
-/*! \obsolete
- Constructs an LCD number, sets the number of digits to \a
- numDigits, the base to decimal, the decimal point mode to 'small'
- and the frame style to a raised box. The segmentStyle() is set to
- \c Outline.
-
- The \a parent and \a name arguments are passed to the QFrame
- constructor.
-
- \sa setDigitCount(), setSmallDecimalPoint()
-*/
-
-QLCDNumber::QLCDNumber(uint numDigits, QWidget *parent, const char *name)
- : QFrame(*new QLCDNumberPrivate, parent)
-{
- setObjectName(QString::fromAscii(name));
- Q_D(QLCDNumber);
- d->ndigits = numDigits;
- d->init();
-}
-#endif //QT3_SUPPORT
/*!
Constructs an LCD number, sets the number of digits to 5, the base
void paintEvent(QPaintEvent *);
public:
-#ifdef QT3_SUPPORT
- QT3_SUPPORT_CONSTRUCTOR QLCDNumber(QWidget* parent, const char* name);
- QT3_SUPPORT_CONSTRUCTOR QLCDNumber(uint numDigits, QWidget* parent, const char* name);
-
- QT3_SUPPORT void setMargin(int margin) { setContentsMargins(margin, margin, margin, margin); }
- QT3_SUPPORT int margin() const
- { int margin; int dummy; getContentsMargins(&margin, &dummy, &dummy, &dummy); return margin; }
-#endif
private:
Q_DISABLE_COPY(QLCDNumber)
}
-#ifdef QT3_SUPPORT
-/*!
- Constructs a line edit with no text.
-
- The maximum text length is set to 32767 characters.
-
- The \a parent and \a name arguments are sent to the QWidget constructor.
-
- \sa setText(), setMaxLength()
-*/
-QLineEdit::QLineEdit(QWidget* parent, const char* name)
- : QWidget(*new QLineEditPrivate, parent,0)
-{
- Q_D(QLineEdit);
- setObjectName(QString::fromAscii(name));
- d->init(QString());
-}
-
-/*!
- Constructs a line edit containing the text \a contents.
-
- The cursor position is set to the end of the line and the maximum
- text length to 32767 characters.
-
- The \a parent and \a name arguments are sent to the QWidget
- constructor.
-
- \sa text(), setMaxLength()
-*/
-
-QLineEdit::QLineEdit(const QString& contents, QWidget* parent, const char* name)
- : QWidget(*new QLineEditPrivate, parent, 0)
-{
- Q_D(QLineEdit);
- setObjectName(QString::fromAscii(name));
- d->init(contents);
-}
-
-/*!
- Constructs a line edit with an input \a inputMask and the text \a
- contents.
-
- The cursor position is set to the end of the line and the maximum
- text length is set to the length of the mask (the number of mask
- characters and separators).
-
- The \a parent and \a name arguments are sent to the QWidget
- constructor.
-
- \sa setMask() text()
-*/
-QLineEdit::QLineEdit(const QString& contents, const QString &inputMask, QWidget* parent, const char* name)
- : QWidget(*new QLineEditPrivate, parent, 0)
-{
- Q_D(QLineEdit);
- setObjectName(QString::fromAscii(name));
- d->init(contents);
- d->control->setInputMask(inputMask);
- d->control->moveCursor(d->control->nextMaskBlank(contents.length()));
-}
-#endif
/*!
Destroys the line edit.
}
-#ifdef QT3_SUPPORT
-/*! \obsolete
-
- Use setText(), setCursorPosition() and setSelection() instead.
-*/
-bool QLineEdit::validateAndSet(const QString &newText, int newPos,
- int newMarkAnchor, int newMarkDrag)
-{
- // The suggested functions above in the docs don't seem to validate,
- // below code tries to mimic previous behaviour.
- QString oldText = text();
- setText(newText);
- if(!hasAcceptableInput()){
- setText(oldText);
- return false;
- }
- int selstart = qMin(newMarkAnchor, newMarkDrag);
- int sellength = qAbs(newMarkAnchor - newMarkDrag);
- if (selstart == newPos) {
- selstart = qMax(newMarkAnchor, newMarkDrag);
- sellength = -sellength;
- }
- //setSelection also set the position
- setSelection(selstart, sellength);
- return true;
-}
-#endif //QT3_SUPPORT
/*!
\property QLineEdit::alignment
}
-#ifdef QT3_SUPPORT
-
-/*!
- \fn void QLineEdit::lostFocus()
-
- This signal is emitted when the line edit has lost focus.
-
- Use editingFinished() instead
- \sa editingFinished(), returnPressed()
-*/
-
-/*!
- Use isModified() instead.
-*/
-bool QLineEdit::edited() const { return isModified(); }
-/*!
- Use setModified() or setText().
-*/
-void QLineEdit::setEdited(bool on) { setModified(on); }
-
-/*!
- There exists no equivalent functionality in Qt 4.
-*/
-int QLineEdit::characterAt(int xpos, QChar *chr) const
-{
- Q_D(const QLineEdit);
- int pos = d->xToPos(xpos + contentsRect().x() - d->hscroll + d->horizontalMargin);
- QString txt = d->control->text();
- if (chr && pos < (int) txt.length())
- *chr = txt.at(pos);
- return pos;
-
-}
-
-/*!
- Use selectedText() and selectionStart() instead.
-*/
-bool QLineEdit::getSelection(int *start, int *end)
-{
- Q_D(QLineEdit);
- if (d->control->hasSelectedText() && start && end) {
- *start = selectionStart();
- *end = *start + selectedText().length();
- return true;
- }
- return false;
-}
-#endif
/*!
|| !(QApplication::activePopupWidget() && QApplication::activePopupWidget()->parentWidget() == this)) {
if (hasAcceptableInput() || d->control->fixup())
emit editingFinished();
-#ifdef QT3_SUPPORT
- emit lostFocus();
-#endif
}
#ifdef Q_WS_MAC
if (d->control->echoMode() == Password || d->control->echoMode() == NoEcho)
public:
explicit QLineEdit(QWidget* parent=0);
explicit QLineEdit(const QString &, QWidget* parent=0);
-#ifdef QT3_SUPPORT
- QT3_SUPPORT_CONSTRUCTOR QLineEdit(QWidget* parent, const char* name);
- QT3_SUPPORT_CONSTRUCTOR QLineEdit(const QString &, QWidget* parent, const char* name);
- QT3_SUPPORT_CONSTRUCTOR QLineEdit(const QString &, const QString &, QWidget* parent=0, const char* name=0);
-#endif
~QLineEdit();
QString text() const;
#ifndef QT_NO_CONTEXTMENU
void contextMenuEvent(QContextMenuEvent *);
#endif
-#ifdef QT3_SUPPORT
- inline QT3_SUPPORT void repaintArea(int, int) { update(); }
-#endif
void inputMethodEvent(QInputMethodEvent *);
void initStyleOption(QStyleOptionFrame *option) const;
QRect cursorRect() const;
public:
-#ifdef QT3_SUPPORT
- inline QT3_SUPPORT void clearModified() { setModified(false); }
- inline QT3_SUPPORT void cursorLeft(bool mark, int steps = 1) { cursorForward(mark, -steps); }
- inline QT3_SUPPORT void cursorRight(bool mark, int steps = 1) { cursorForward(mark, steps); }
- QT3_SUPPORT bool validateAndSet(const QString &, int, int, int);
- inline QT3_SUPPORT bool frame() const { return hasFrame(); }
-#ifndef QT_NO_VALIDATOR
- inline QT3_SUPPORT void clearValidator() { setValidator(0); }
-#endif
- inline QT3_SUPPORT bool hasMarkedText() const { return hasSelectedText(); }
- inline QT3_SUPPORT QString markedText() const { return selectedText(); }
- QT3_SUPPORT bool edited() const;
- QT3_SUPPORT void setEdited(bool);
- QT3_SUPPORT int characterAt(int, QChar*) const;
- QT3_SUPPORT bool getSelection(int *, int *);
-
- QT3_SUPPORT void setFrameRect(QRect) {}
- QT3_SUPPORT QRect frameRect() const { return QRect(); }
- enum DummyFrame { Box, Sunken, Plain, Raised, MShadow, NoFrame, Panel, StyledPanel,
- HLine, VLine, GroupBoxPanel, WinPanel, ToolBarPanel, MenuBarPanel,
- PopupPanel, LineEditPanel, TabWidgetPanel, MShape };
- QT3_SUPPORT void setFrameShadow(DummyFrame) {}
- QT3_SUPPORT DummyFrame frameShadow() const { return Plain; }
- QT3_SUPPORT void setFrameShape(DummyFrame) {}
- QT3_SUPPORT DummyFrame frameShape() const { return NoFrame; }
- QT3_SUPPORT void setFrameStyle(int) {}
- QT3_SUPPORT int frameStyle() const { return 0; }
- QT3_SUPPORT int frameWidth() const { return 0; }
- QT3_SUPPORT void setLineWidth(int) {}
- QT3_SUPPORT int lineWidth() const { return 0; }
- QT3_SUPPORT void setMargin(int margin) { setContentsMargins(margin, margin, margin, margin); }
- QT3_SUPPORT int margin() const
- { int margin; int dummy; getContentsMargins(&margin, &dummy, &dummy, &dummy); return margin; }
- QT3_SUPPORT void setMidLineWidth(int) {}
- QT3_SUPPORT int midLineWidth() const { return 0; }
-
-Q_SIGNALS:
- QT_MOC_COMPAT void lostFocus();
-#endif
private:
friend class QAbstractSpinBox;
d_func()->init();
}
-#ifdef QT3_SUPPORT
-/*!
- \obsolete
- Constructs a QMainWindow with the given \a parent, \a name, and
- with the specified widget \a flags.
- */
-QMainWindow::QMainWindow(QWidget *parent, const char *name, Qt::WindowFlags flags)
- : QWidget(*(new QMainWindowPrivate()), parent, flags | Qt::WType_TopLevel)
-{
- setObjectName(QString::fromAscii(name));
- d_func()->init();
-}
-#endif
/*!
Destroys the main window.
virtual QMenu *createPopupMenu();
#endif
-#ifdef QT3_SUPPORT
- QT3_SUPPORT_CONSTRUCTOR QMainWindow(QWidget *parent, const char *name, Qt::WindowFlags flags = 0);
-#endif
#ifndef QT_NO_DOCKWIDGET
public Q_SLOTS:
#ifndef QT_NO_MENUBAR
-#ifdef QT3_SUPPORT
-#include <private/qaction_p.h>
-#include <qmenudata.h>
-#endif
#include "qmenu_p.h"
#include "qmenubar_p.h"
extension->hide();
}
q->updateGeometry();
-#ifdef QT3_SUPPORT
- if (parent) {
- QMenubarUpdatedEvent menubarUpdated(q);
- QApplication::sendEvent(parent, &menubarUpdated);
- }
-#endif
}
QRect QMenuBarPrivate::actionRect(QAction *act) const
Q_Q(QMenuBar);
if (QAction *action = qobject_cast<QAction *>(q->sender())) {
emit q->triggered(action);
-#ifdef QT3_SUPPORT
- emit q->activated(q->findIdForAction(action));
-#endif
}
}
class QMenuBarPrivate;
class QStyleOptionMenuItem;
class QWindowsStyle;
-#ifdef QT3_SUPPORT
-class QMenuItem;
-#endif
class Q_WIDGETS_EXPORT QMenuBar : public QWidget
{
QMenuBarPrivate() : itemsDirty(0), currentAction(0), mouseDown(0),
closePopupMode(0), defaultPopDown(1), popupState(0), keyboardState(0), altPressed(0),
nativeMenuBar(-1), doChildEffects(false), platformMenuBar(0)
-#ifdef QT3_SUPPORT
- , doAutoResize(false)
-#endif
#ifdef Q_WS_WINCE
, wce_menubar(0), wceClassicMenu(false)
QPointer<QAction> defaultAction;
QBasicTimer autoReleaseTimer;
-#ifdef QT3_SUPPORT
- bool doAutoResize;
-#endif
QPlatformMenuBar *platformMenuBar;
#ifdef Q_WS_WINCE
}
#endif // Q_WS_MAC
-#ifdef QT3_SUPPORT
-/*!
- Use one of the constructors that doesn't take the \a name
- argument and then use setObjectName() instead.
-*/
-QPushButton::QPushButton(QWidget *parent, const char *name)
- : QAbstractButton(*new QPushButtonPrivate, parent)
-{
- Q_D(QPushButton);
- setObjectName(QString::fromAscii(name));
- d->init();
-}
-
-/*!
- Use one of the constructors that doesn't take the \a name
- argument and then use setObjectName() instead.
-*/
-QPushButton::QPushButton(const QString &text, QWidget *parent, const char *name)
- : QAbstractButton(*new QPushButtonPrivate, parent)
-{
- Q_D(QPushButton);
- setObjectName(QString::fromAscii(name));
- setText(text);
- d->init();
-}
-
-/*!
- Use one of the constructors that doesn't take the \a name
- argument and then use setObjectName() instead.
-*/
-QPushButton::QPushButton(const QIcon& icon, const QString &text, QWidget *parent, const char *name)
- : QAbstractButton(*new QPushButtonPrivate, parent)
-{
- Q_D(QPushButton);
- setObjectName(QString::fromAscii(name));
- setText(text);
- setIcon(icon);
- d->init();
-}
-#endif
/*!
\fn void QPushButton::openPopup()
QPushButton(QPushButtonPrivate &dd, QWidget* parent = 0);
public:
-#ifdef QT3_SUPPORT
- QT3_SUPPORT_CONSTRUCTOR QPushButton(QWidget *parent, const char* name);
- QT3_SUPPORT_CONSTRUCTOR QPushButton(const QString &text, QWidget *parent, const char* name);
- QT3_SUPPORT_CONSTRUCTOR QPushButton(const QIcon& icon, const QString &text, QWidget *parent, const char* name);
- inline QT3_SUPPORT void openPopup() { showMenu(); }
- inline QT3_SUPPORT bool isMenuButton() const { return menu() != 0; }
- inline QT3_SUPPORT void setPopup(QMenu* popup) {setMenu(popup); }
- inline QT3_SUPPORT QMenu* popup() const { return menu(); }
-#endif
private:
Q_DISABLE_COPY(QPushButton)
return QAbstractButton::event(e);
}
-#ifdef QT3_SUPPORT
-/*!
- Use one of the constructors that doesn't take the \a name
- argument and then use setObjectName() instead.
-*/
-QRadioButton::QRadioButton(QWidget *parent, const char* name)
- : QAbstractButton(*new QRadioButtonPrivate, parent)
-{
- Q_D(QRadioButton);
- d->init();
- setObjectName(QString::fromAscii(name));
-}
-
-/*!
- Use one of the constructors that doesn't take the \a name
- argument and then use setObjectName() instead.
-*/
-QRadioButton::QRadioButton(const QString &text, QWidget *parent, const char* name)
- : QAbstractButton(*new QRadioButtonPrivate, parent)
-{
- Q_D(QRadioButton);
- d->init();
- setObjectName(QString::fromAscii(name));
- setText(text);
-}
-
-#endif
QT_END_NAMESPACE
void mouseMoveEvent(QMouseEvent *);
void initStyleOption(QStyleOptionButton *button) const;
-#ifdef QT3_SUPPORT
-public:
- QT3_SUPPORT_CONSTRUCTOR QRadioButton(QWidget *parent, const char* name);
- QT3_SUPPORT_CONSTRUCTOR QRadioButton(const QString &text, QWidget *parent, const char* name);
-#endif
private:
Q_DECLARE_PRIVATE(QRadioButton)
}
-#ifdef QT3_SUPPORT
-/*!
- Use one of the constructors that doesn't take the \a name
- argument and then use setObjectName() instead.
-*/
-QScrollBar::QScrollBar(QWidget *parent, const char *name)
- : QAbstractSlider(*new QScrollBarPrivate, parent)
-{
- setObjectName(QString::fromAscii(name));
- d_func()->orientation = Qt::Vertical;
- d_func()->init();
-}
-
-/*!
- Use one of the constructors that doesn't take the \a name
- argument and then use setObjectName() instead.
-*/
-QScrollBar::QScrollBar(Qt::Orientation orientation, QWidget *parent, const char *name)
- : QAbstractSlider(*new QScrollBarPrivate, parent)
-{
- setObjectName(QString::fromAscii(name));
- d_func()->orientation = orientation;
- d_func()->init();
-}
-
-/*!
- Use one of the constructors that doesn't take the \a name
- argument and then use setObjectName() instead.
-*/
-QScrollBar::QScrollBar(int minimum, int maximum, int lineStep, int pageStep,
- int value, Qt::Orientation orientation,
- QWidget *parent, const char *name)
- : QAbstractSlider(*new QScrollBarPrivate, parent)
-{
- Q_D(QScrollBar);
- setObjectName(QString::fromAscii(name));
- d->minimum = minimum;
- d->maximum = maximum;
- d->singleStep = lineStep;
- d->pageStep = pageStep;
- d->value = value;
- d->orientation = orientation;
- d->init();
-}
-#endif // QT3_SUPPORT
/*!
Destroys the scroll bar.
#endif
void initStyleOption(QStyleOptionSlider *option) const;
-#ifdef QT3_SUPPORT
-public:
- QT3_SUPPORT_CONSTRUCTOR QScrollBar(QWidget *parent, const char* name);
- QT3_SUPPORT_CONSTRUCTOR QScrollBar(Qt::Orientation, QWidget *parent, const char* name);
- QT3_SUPPORT_CONSTRUCTOR QScrollBar(int minValue, int maxValue, int lineStep, int pageStep,
- int value, Qt::Orientation, QWidget *parent=0, const char* name = 0);
- inline QT3_SUPPORT bool draggingSlider() { return isSliderDown(); }
-#endif
private:
friend Q_WIDGETS_EXPORT QStyleOptionSlider qt_qscrollbarStyleOption(QScrollBar *scrollBar);
d->init();
}
-#ifdef QT3_SUPPORT
-/*!
- \obsolete
-
- Constructs a resize corner with the given \a name, as a child
- widget of the given \a parent.
-*/
-QSizeGrip::QSizeGrip(QWidget * parent, const char* name)
- : QWidget(*new QSizeGripPrivate, parent, 0)
-{
- Q_D(QSizeGrip);
- setObjectName(QString::fromAscii(name));
- d->init();
-}
-#endif
void QSizeGripPrivate::init()
{
#endif
public:
-#ifdef QT3_SUPPORT
- QT3_SUPPORT_CONSTRUCTOR QSizeGrip(QWidget *parent, const char *name);
-#endif
private:
Q_DECLARE_PRIVATE(QSizeGrip)
d_func()->init();
}
-#ifdef QT3_SUPPORT
-/*!
- Use QSlider() and QObject::setObjectName() instead.
-
- \oldcode
- QSlider *mySlider = new QSlider(parent, name);
- \newcode
- QSlider *mySlider = new QSlider(parent);
- mySlider->setObjectName(name);
- \endcode
-*/
-QSlider::QSlider(QWidget *parent, const char *name)
- : QAbstractSlider(*new QSliderPrivate, parent)
-{
- setObjectName(QString::fromAscii(name));
- d_func()->orientation = Qt::Vertical;
- d_func()->init();
-}
-
-/*!
- Use QSlider() and QObject::setObjectName() instead.
-
- \oldcode
- QSlider *mySlider = new QSlider(orientation, parent, name);
- \newcode
- QSlider *mySlider = new QSlider(orientation, parent);
- mySlider->setObjectName(name);
- \endcode
-*/
-QSlider::QSlider(Qt::Orientation orientation, QWidget *parent, const char *name)
- : QAbstractSlider(*new QSliderPrivate, parent)
-{
- setObjectName(QString::fromAscii(name));
- d_func()->orientation = orientation;
- d_func()->init();
-}
-
-/*!
- Use QSlider(), QObject::setObjectName() and the functionality
- inherited from QAbstractSlider instead.
-
- \oldcode
- QSlider *mySlider = new QSlider(minValue, maxValue, pageStep,
- value, orientation, parent, name);
- \newcode
- QSlider *mySlider = new QSlider(orientation, parent);
- mySlider->setObjectName(name);
- mySlider->setMinimum(minValue);
- mySlider->setMaximum(maxValue);
- mySlider->setPageStep(pageStep);
- mySlider->setValue(value);
- \endcode
-*/
-QSlider::QSlider(int minValue, int maxValue, int pageStep, int value, Qt::Orientation orientation,
- QWidget *parent, const char *name)
- : QAbstractSlider(*new QSliderPrivate, parent)
-{
- Q_D(QSlider);
- setObjectName(QString::fromAscii(name));
- d->minimum = minValue;
- d->maximum = maxValue;
- d->pageStep = pageStep;
- d->position = d->value = value;
- d->orientation = orientation;
- d->init();
-}
-#endif
/*!
Destroys this slider.
void mouseMoveEvent(QMouseEvent *ev);
void initStyleOption(QStyleOptionSlider *option) const;
-#ifdef QT3_SUPPORT
-public:
- QT3_SUPPORT_CONSTRUCTOR QSlider(QWidget *parent, const char *name);
- QT3_SUPPORT_CONSTRUCTOR QSlider(Qt::Orientation, QWidget *parent, const char *name);
- QT3_SUPPORT_CONSTRUCTOR QSlider(int minValue, int maxValue, int pageStep, int value,
- Qt::Orientation orientation,
- QWidget *parent = 0, const char *name = 0);
- inline QT3_SUPPORT void setTickmarks(TickPosition position) { setTickPosition(position); }
- inline QT3_SUPPORT TickPosition tickmarks() const { return tickPosition(); }
-public Q_SLOTS:
- inline QT_MOC_COMPAT void addStep() { triggerAction(SliderSingleStepAdd); }
- inline QT_MOC_COMPAT void subtractStep() { triggerAction(SliderSingleStepSub); }
-#endif
private:
friend Q_WIDGETS_EXPORT QStyleOptionSlider qt_qsliderStyleOption(QSlider *slider);
d->init();
}
-#ifdef QT3_SUPPORT
-/*!
- Use one of the constructors that doesn't take the \a name
- argument and then use setObjectName() instead.
-*/
-QSpinBox::QSpinBox(QWidget *parent, const char *name)
- : QAbstractSpinBox(*new QSpinBoxPrivate, parent)
-{
- Q_D(QSpinBox);
- setObjectName(QString::fromAscii(name));
- d->init();
-}
-
-/*!
- Use one of the constructors that doesn't take the \a name
- argument and then use setObjectName() instead.
-*/
-QSpinBox::QSpinBox(int minimum, int maximum, int step, QWidget *parent, const char *name)
- : QAbstractSpinBox(*new QSpinBoxPrivate, parent)
-{
- Q_D(QSpinBox);
- d->minimum = QVariant(qMin<int>(minimum, maximum));
- d->maximum = QVariant(qMax<int>(minimum, maximum));
- d->singleStep = QVariant(step);
- setObjectName(QString::fromAscii(name));
- d->init();
-}
-
-#endif
/*!
\property QSpinBox::value
public:
explicit QSpinBox(QWidget *parent = 0);
-#ifdef QT3_SUPPORT
- QT3_SUPPORT_CONSTRUCTOR QSpinBox(QWidget *parent, const char *name);
- QT3_SUPPORT_CONSTRUCTOR QSpinBox(int min, int max, int step, QWidget *parent,
- const char *name = 0);
-#endif
int value() const;
void setRange(int min, int max);
-#ifdef QT3_SUPPORT
- inline QT3_SUPPORT void setLineStep(int step) { setSingleStep(step); }
- inline QT3_SUPPORT void setMaxValue(int val) { setMaximum(val); }
- inline QT3_SUPPORT void setMinValue(int val) { setMinimum(val); }
- inline QT3_SUPPORT int maxValue() const { return maximum(); }
- inline QT3_SUPPORT int minValue() const { return minimum(); }
-#endif
protected:
bool event(QEvent *event);
void showMessage(const QString &message, int alignment = Qt::AlignLeft,
const QColor &color = Qt::black);
void clearMessage();
-#ifdef QT3_SUPPORT
- inline QT_MOC_COMPAT void message(const QString &str, int alignment = Qt::AlignLeft,
- const QColor &color = Qt::black) { showMessage(str, alignment, color); }
- inline QT_MOC_COMPAT void clear() { clearMessage(); }
-#endif
Q_SIGNALS:
void messageChanged(const QString &message);
return 0;
}
-#ifdef QT3_SUPPORT
-static void setStretch(QWidget *w, int sf)
-{
- QSizePolicy sp = w->sizePolicy();
- sp.setHorizontalStretch(sf);
- sp.setVerticalStretch(sf);
- w->setSizePolicy(sp);
-}
-
-static int getStretch(const QWidget *w)
-{
- QSizePolicy sp = w->sizePolicy();
- return qMax(sp.horizontalStretch(), sp.verticalStretch());
-}
-
-void QSplitter::setResizeMode(QWidget *w, ResizeMode mode)
-{
- /*
- Internal comment:
-
- This function tries to simulate the Qt 3.x ResizeMode
- behavior using QSizePolicy stretch factors. This isn't easy,
- because the default \l ResizeMode was \l Stretch, not \l
- KeepSize, whereas the default stetch factor is 0.
-
- So what we do is this: When the user calls setResizeMode()
- the first time, we iterate through all the child widgets and
- set their stretch factors to 1. Later on, if children are
- added (using addWidget()), their stretch factors are also set
- to 1.
-
- There is just one problem left: Often, setResizeMode() is
- called \e{before} addWidget(), because addWidget() is called
- from the event loop. In that case, we use a special value,
- 243, instead of 0 to prevent 0 from being overwritten with 1
- in addWidget(). This is a wicked hack, but fortunately it
- only occurs as a result of calling a \c QT3_SUPPORT function.
- */
-
- Q_D(QSplitter);
- bool metWidget = false;
- if (!d->compatMode) {
- d->compatMode = true;
- for (int i = 0; i < d->list.size(); ++i) {
- QSplitterLayoutStruct *s = d->list.at(i);
- if (s->widget == w)
- metWidget = true;
- if (getStretch(s->widget) == 0)
- setStretch(s->widget, 1);
- }
- }
- int sf;
- if (mode == KeepSize)
- sf = metWidget ? 0 : 243;
- else
- sf = 1;
- setStretch(w, sf);
-}
-
-/*!
- Use one of the constructors that doesn't take the \a name
- argument and then use setObjectName() instead.
-*/
-QSplitter::QSplitter(QWidget *parent, const char *name)
- : QFrame(*new QSplitterPrivate, parent)
-{
- Q_D(QSplitter);
- setObjectName(QString::fromAscii(name));
- d->orient = Qt::Horizontal;
- d->init();
-}
-
-
-/*!
- Use one of the constructors that don't take the \a name argument
- and then use setObjectName() instead.
-*/
-QSplitter::QSplitter(Qt::Orientation orientation, QWidget *parent, const char *name)
- : QFrame(*new QSplitterPrivate, parent)
-{
- Q_D(QSplitter);
- setObjectName(QString::fromAscii(name));
- d->orient = orientation;
- d->init();
-}
-#endif
/*!
\internal
if (newHandle && q->isVisible())
newHandle->show(); // will trigger sending of post events
-#ifdef QT3_SUPPORT
- if (compatMode) {
- int sf = getStretch(sls->widget);
- if (sf == 243)
- setStretch(sls->widget, 0);
- else if (sf == 0)
- setStretch(sls->widget, 1);
- }
-#endif
}
return sls;
}
case QEvent::HideToParent:
case QEvent::ShowToParent:
case QEvent::LayoutRequest:
-#ifdef QT3_SUPPORT
- case QEvent::LayoutHint:
-#endif
d->recalc(isVisible());
break;
default:
d->opaque = on;
}
-#ifdef QT3_SUPPORT
-/*!
- \fn void QSplitter::moveToFirst(QWidget *widget)
-
- Use insertWidget(0, \a widget) instead.
-*/
-
-
-/*!
- \fn void QSplitter::moveToLast(QWidget *widget)
-
- Use addWidget(\a widget) instead.
-*/
-
-/*!
- \fn void QSplitter::setResizeMode(QWidget *widget, ResizeMode mode)
-
- Use setStretchFactor() instead.
-
- \oldcode
- splitter->setResizeMode(firstChild, QSplitter::KeepSize);
- splitter->setResizeMode(secondChild, QSplitter::Stretch);
- \newcode
- splitter->setStretchFactor(splitter->indexOf(firstChild), 0);
- splitter->setStretchFactor(splitter->indexOf(secondChild), 1);
- \endcode
-*/
-
-/*!
- \fn void QSplitter::setCollapsible(QWidget *widget, bool collapsible)
-
- Use setCollapsible(indexOf(\a widget, \a collapsible)) instead.
-*/
-
-/*!
- \fn void QSplitter::setMargin(int margin)
- Sets the width of the margin around the contents of the widget to \a margin.
-
- Use QWidget::setContentsMargins() instead.
- \sa margin(), QWidget::setContentsMargins()
-*/
-
-/*!
- \fn int QSplitter::margin() const
- Returns the width of the margin around the contents of the widget.
-
- Use QWidget::getContentsMargins() instead.
- \sa setMargin(), QWidget::getContentsMargins()
-*/
-
-#endif
/*!
\reimp
void setRubberBand(int position);
int closestLegalPosition(int, int);
-#ifdef QT3_SUPPORT
-public:
- QT3_SUPPORT_CONSTRUCTOR QSplitter(QWidget* parent, const char* name);
- QT3_SUPPORT_CONSTRUCTOR QSplitter(Qt::Orientation, QWidget* parent, const char* name);
- enum ResizeMode { Stretch, KeepSize, FollowSizeHint, Auto };
- QT3_SUPPORT void setResizeMode(QWidget *w, ResizeMode mode);
- inline QT3_SUPPORT void moveToFirst(QWidget *w) { insertWidget(0,w); }
- inline QT3_SUPPORT void moveToLast(QWidget *w) { addWidget(w); }
- inline QT3_SUPPORT void setCollapsible(QWidget *w, bool collapse)
- { setCollapsible(indexOf(w), collapse); }
- QT3_SUPPORT void setMargin(int margin) { setContentsMargins(margin, margin, margin, margin); }
- QT3_SUPPORT int margin() const
- { int margin; int dummy; getContentsMargins(&margin, &dummy, &dummy, &dummy); return margin; }
-#endif
private:
Q_DISABLE_COPY(QSplitter)
Status Bar}, {Application Example}
*/
-#ifdef QT3_SUPPORT
-/*!
- Constructs a status bar with a size grip and the given \a parent
- and object \a name.
-
- Use the QStatusBar() constructor and the QObject::setObjectName()
- function instead.
-
- \oldcode
- QStatusBar *myStatusBar = new QStatusBar(parent, name);
- \newcode
- QStatusBar *myStatusBar = new QStatusBar(parent);
- myStatusBar->setObjectName(name);
- \endcode
-*/
-QStatusBar::QStatusBar(QWidget * parent, const char *name)
- : QWidget(*new QStatusBarPrivate, parent, 0)
-{
- Q_D(QStatusBar);
- setObjectName(QString::fromAscii(name));
- d->box = 0;
- d->timer = 0;
-
-#ifndef QT_NO_SIZEGRIP
- d->resizer = 0;
- d->showSizeGrip = false;
- setSizeGripEnabled(true); // causes reformat()
-#else
- reformat();
-#endif
-}
-
-
-/*!
- \fn void QStatusBar::addWidget(QWidget * widget, int stretch, bool permanent)
-
- Use addWidget() or addPermanentWidget() instead, depending on the
- value of the \a permanent parameter.
-
- \oldcode
- QStatusBar *myStatusBar;
- myStatusBar->addWidget(widget, stretch, permanent); // permanent == true
- \newcode
- QStatusBar *myStatusBar;
- myStatusBar->addPermanentWidget(widget, stretch);
- \endcode
- */
-
-#endif
/*!
Constructs a status bar with a size grip and the given \a parent.
Q_D(QStatusBar);
if (e->type() == QEvent::LayoutRequest
-#ifdef QT3_SUPPORT
- || e->type() == QEvent::LayoutHint
-#endif
) {
// Calculate new strut height and call reformat() if it has changed
int maxH = fontMetrics().height();
void showMessage(const QString &text, int timeout = 0);
void clearMessage();
-#ifdef QT3_SUPPORT
-public:
- QT3_SUPPORT_CONSTRUCTOR QStatusBar(QWidget* parent, const char* name);
- QT3_SUPPORT void addWidget(QWidget *w, int stretch, bool permanent)
- { if (permanent) addPermanentWidget(w, stretch); else addWidget(w, stretch); }
-public Q_SLOTS:
- inline QT_MOC_COMPAT void message(const QString &text, int timeout = 0) { showMessage(text, timeout); }
- inline QT_MOC_COMPAT void clear() { clearMessage(); }
-#endif
Q_SIGNALS:
void messageChanged(const QString &text);
QAccessible::updateAccessibility(this, index + 1, QAccessible::Selection);
}
#endif
-#ifdef QT3_SUPPORT
- emit selected(index);
-#endif
emit currentChanged(index);
}
}
void changeEvent(QEvent *);
void initStyleOption(QStyleOptionTab *option, int tabIndex) const;
-#ifdef QT3_SUPPORT
-public Q_SLOTS:
- QT_MOC_COMPAT void setCurrentTab(int index) { setCurrentIndex(index); }
-Q_SIGNALS:
- QT_MOC_COMPAT void selected(int);
-#endif
friend class QAccessibleTabBar;
private:
d->init();
}
-#ifdef QT3_SUPPORT
-/*!
- Use one of the constructors that doesn't take the \a name
- argument and then use setObjectName() instead.
-*/
-QTabWidget::QTabWidget(QWidget *parent, const char *name, Qt::WindowFlags f)
- : QWidget(*new QTabWidgetPrivate, parent, f)
-{
- Q_D(QTabWidget);
- setObjectName(QString::fromAscii(name));
- d->init();
-}
-#endif
/*!
Destroys the tabbed widget.
if (index < stack->count() && index >= 0)
stack->setCurrentIndex(index);
emit q->currentChanged(index);
-#ifdef QT3_SUPPORT
- emit q->selected(q->tabText(index));
- emit q->currentChanged(stack->widget(index));
-#endif
}
void QTabWidgetPrivate::_q_removeTab(int index)
bool event(QEvent *);
void initStyleOption(QStyleOptionTabWidgetFrame *option) const;
-#ifdef QT3_SUPPORT
-public:
- QT3_SUPPORT_CONSTRUCTOR QTabWidget(QWidget *parent, const char *name, Qt::WindowFlags f = 0);
-
- inline QT3_SUPPORT void insertTab(QWidget * w, const QString &s, int index = -1) { insertTab(index, w, s); }
- inline QT3_SUPPORT void insertTab(QWidget *child, const QIcon& icon,
- const QString &label, int index = -1) { insertTab(index, child, icon, label); }
-
- inline QT3_SUPPORT void changeTab(QWidget *w, const QString &s) {setTabText(indexOf(w), s); }
- inline QT3_SUPPORT void changeTab(QWidget *w, const QIcon& icon,
- const QString &label) { int idx = indexOf(w); setTabText(idx, label); setTabIcon(idx, icon); }
-
- inline QT3_SUPPORT bool isTabEnabled( QWidget *w) const {return isTabEnabled(indexOf(w)); }
- inline QT3_SUPPORT void setTabEnabled(QWidget *w, bool b) { setTabEnabled(indexOf(w), b); }
-
- inline QT3_SUPPORT QString tabLabel(QWidget *w) const {return tabText(indexOf(w)); }
- inline QT3_SUPPORT void setTabLabel(QWidget *w, const QString &l) { setTabText(indexOf(w), l); }
-
- inline QT3_SUPPORT QIcon tabIconSet(QWidget * w) const {return tabIcon(indexOf(w)); }
- inline QT3_SUPPORT void setTabIconSet(QWidget * w, const QIcon & icon) { setTabIcon(indexOf(w), icon); }
-
- inline QT3_SUPPORT void removeTabToolTip(QWidget * w) {
-#ifndef QT_NO_TOOLTIP
- setTabToolTip(indexOf(w), QString());
-#else
- Q_UNUSED(w);
-#endif
- }
- inline QT3_SUPPORT void setTabToolTip(QWidget * w, const QString & tip) {
-#ifndef QT_NO_TOOLTIP
- setTabToolTip(indexOf(w), tip);
-#else
- Q_UNUSED(w);
- Q_UNUSED(tip);
-#endif
- }
-
- inline QT3_SUPPORT QString tabToolTip(QWidget * w) const {
-#ifndef QT_NO_TOOLTIP
- return tabToolTip(indexOf(w));
-#else
- Q_UNUSED(w);
- return QString();
-#endif
- }
-
- inline QT3_SUPPORT QWidget * currentPage() const { return currentWidget(); }
- inline QT3_SUPPORT QWidget *page(int index) const { return widget(index); }
- inline QT3_SUPPORT QString label(int index) const { return tabText(index); }
- inline QT3_SUPPORT int currentPageIndex() const { return currentIndex(); }
-
- inline QT3_SUPPORT int margin() const { return 0; }
- inline QT3_SUPPORT void setMargin(int) {}
-
-public Q_SLOTS:
- inline QT_MOC_COMPAT void setCurrentPage(int index) { setCurrentIndex(index); }
- inline QT_MOC_COMPAT void showPage(QWidget *w) { setCurrentIndex(indexOf(w)); }
- inline QT_MOC_COMPAT void removePage(QWidget *w) { removeTab(indexOf(w)); }
-
-Q_SIGNALS:
- QT_MOC_COMPAT void currentChanged(QWidget *);
- QT_MOC_COMPAT void selected(const QString&);
-#endif // QT3_SUPPORT
private:
Q_DECLARE_PRIVATE(QTabWidget)
d->init();
}
-#ifdef QT3_SUPPORT
-/*!
- Use one of the constructors that doesn't take the \a name
- argument and then use setObjectName() instead.
-*/
-QTextBrowser::QTextBrowser(QWidget *parent, const char *name)
- : QTextEdit(*new QTextBrowserPrivate, parent)
-{
- setObjectName(QString::fromAscii(name));
- Q_D(QTextBrowser);
- d->init();
-}
-#endif
/*!
\internal
automatic bullet lists are supported.
*/
-#ifdef QT3_SUPPORT
-/*!
- \enum QTextEdit::CursorAction
- \compat
-
- \value MoveBackward
- \value MoveForward
- \value MoveWordBackward
- \value MoveWordForward
- \value MoveUp
- \value MoveDown
- \value MoveLineStart
- \value MoveLineEnd
- \value MoveHome
- \value MoveEnd
- \value MovePageUp
- \value MovePageDown
-
- \omitvalue MovePgUp
- \omitvalue MovePgDown
-*/
-#endif
/*!
Constructs an empty QTextEdit with parent \a
d->init(text);
}
-#ifdef QT3_SUPPORT
-/*!
- Use one of the constructors that doesn't take the \a name
- argument and then use setObjectName() instead.
-*/
-QTextEdit::QTextEdit(QWidget *parent, const char *name)
- : QAbstractScrollArea(*new QTextEditPrivate, parent)
-{
- Q_D(QTextEdit);
- d->init();
- setObjectName(QString::fromAscii(name));
-}
-#endif
/*!
{
Q_Q(QTextEdit);
emit q->currentCharFormatChanged(fmt);
-#ifdef QT3_SUPPORT
- // compat signals
- emit q->currentFontChanged(fmt.font());
- emit q->currentColorChanged(fmt.foreground().color());
-#endif
}
void QTextEditPrivate::updateDefaultTextOption()
setPlainText(text);
}
-#ifdef QT3_SUPPORT
-/*!
- Use the QTextCursor class instead.
-*/
-void QTextEdit::moveCursor(CursorAction action, QTextCursor::MoveMode mode)
-{
- Q_D(QTextEdit);
- if (action == MovePageUp) {
- d->pageUpDown(QTextCursor::Up, mode);
- return;
- } else if (action == MovePageDown) {
- d->pageUpDown(QTextCursor::Down, mode);
- return;
- }
-
- QTextCursor cursor = d->control->textCursor();
- QTextCursor::MoveOperation op = QTextCursor::NoMove;
- switch (action) {
- case MoveBackward: op = QTextCursor::Left; break;
- case MoveForward: op = QTextCursor::Right; break;
- case MoveWordBackward: op = QTextCursor::WordLeft; break;
- case MoveWordForward: op = QTextCursor::WordRight; break;
- case MoveUp: op = QTextCursor::Up; break;
- case MoveDown: op = QTextCursor::Down; break;
- case MoveLineStart: op = QTextCursor::StartOfLine; break;
- case MoveLineEnd: op = QTextCursor::EndOfLine; break;
- case MoveHome: op = QTextCursor::Start; break;
- case MoveEnd: op = QTextCursor::End; break;
- default: return;
- }
- cursor.movePosition(op, mode);
- d->control->setTextCursor(cursor);
-}
-
-/*!
- Use the QTextCursor class instead.
-*/
-void QTextEdit::moveCursor(CursorAction action, bool select)
-{
- moveCursor(action, select ? QTextCursor::KeepAnchor : QTextCursor::MoveAnchor);
-}
-
-/*!
- Executes keyboard action \a action.
-
- Use the QTextCursor class instead.
-
- \sa textCursor()
-*/
-void QTextEdit::doKeyboardAction(KeyboardAction action)
-{
- Q_D(QTextEdit);
- QTextCursor cursor = d->control->textCursor();
- switch (action) {
- case ActionBackspace: cursor.deletePreviousChar(); break;
- case ActionDelete: cursor.deleteChar(); break;
- case ActionReturn: cursor.insertBlock(); break;
- case ActionKill: {
- QTextBlock block = cursor.block();
- if (cursor.position() == block.position() + block.length() - 2)
- cursor.movePosition(QTextCursor::Right, QTextCursor::KeepAnchor);
- else
- cursor.movePosition(QTextCursor::EndOfBlock, QTextCursor::KeepAnchor);
- cursor.deleteChar();
- break;
- }
- case ActionWordBackspace:
- cursor.movePosition(QTextCursor::PreviousWord, QTextCursor::KeepAnchor);
- cursor.deletePreviousChar();
- break;
- case ActionWordDelete:
- cursor.movePosition(QTextCursor::EndOfWord, QTextCursor::KeepAnchor);
- cursor.deleteChar();
- break;
- }
- d->control->setTextCursor(cursor);
-}
-
-/*!
- Returns all the text in the text edit as plain text.
-*/
-QString QTextEdit::text() const
-{
- Q_D(const QTextEdit);
- if (d->textFormat == Qt::RichText || d->textFormat == Qt::LogText || (d->textFormat == Qt::AutoText && d->preferRichText))
- return d->control->toHtml();
- else
- return d->control->toPlainText();
-}
-
-
-/*!
- Sets the text format to format \a f.
-
- \sa textFormat()
-*/
-void QTextEdit::setTextFormat(Qt::TextFormat f)
-{
- Q_D(QTextEdit);
- d->textFormat = f;
-}
-
-/*!
- Returns the text format.
-
- \sa setTextFormat()
-*/
-Qt::TextFormat QTextEdit::textFormat() const
-{
- Q_D(const QTextEdit);
- return d->textFormat;
-}
-
-#endif // QT3_SUPPORT
/*!
Appends a new paragraph with \a text to the end of the text edit.
#ifndef QT_NO_TEXTEDIT
-#ifdef QT3_SUPPORT
-#include <QtGui/qtextobject.h>
-#include <QtGui/qtextlayout.h>
-#endif
QT_BEGIN_HEADER
virtual void scrollContentsBy(int dx, int dy);
-#ifdef QT3_SUPPORT
-Q_SIGNALS:
- QT_MOC_COMPAT void currentFontChanged(const QFont &f);
- QT_MOC_COMPAT void currentColorChanged(const QColor &c);
-
-public:
- QT3_SUPPORT_CONSTRUCTOR QTextEdit(QWidget *parent, const char *name);
- inline QT3_SUPPORT bool find(const QString &exp, bool cs, bool wo)
- {
- QTextDocument::FindFlags flags = 0;
- if (cs)
- flags |= QTextDocument::FindCaseSensitively;
- if (wo)
- flags |= QTextDocument::FindWholeWords;
- return find(exp, flags);
- }
-
- inline QT3_SUPPORT void sync() {}
-
- QT3_SUPPORT void moveCursor(CursorAction action, QTextCursor::MoveMode mode = QTextCursor::MoveAnchor);
- QT3_SUPPORT void moveCursor(CursorAction action, bool select);
-
- enum KeyboardAction {
- ActionBackspace,
- ActionDelete,
- ActionReturn,
- ActionKill,
- ActionWordBackspace,
- ActionWordDelete
- };
-
- QT3_SUPPORT void doKeyboardAction(KeyboardAction action);
-
- QT3_SUPPORT QString text() const;
- QT3_SUPPORT void setTextFormat(Qt::TextFormat);
- QT3_SUPPORT Qt::TextFormat textFormat() const;
-
- inline QT3_SUPPORT void setBold(bool b) { setFontWeight(b ? QFont::Bold : QFont::Normal); }
- inline QT3_SUPPORT void setUnderline(bool b) { setFontUnderline(b); }
- inline QT3_SUPPORT void setItalic(bool i) { setFontItalic(i); }
- inline QT3_SUPPORT void setFamily(const QString &family) { setFontFamily(family); }
- inline QT3_SUPPORT void setPointSize(int size) { setFontPointSize(size); }
-
- inline QT3_SUPPORT bool italic() const { return fontItalic(); }
- inline QT3_SUPPORT bool bold() const { return fontWeight() >= QFont::Bold; }
- inline QT3_SUPPORT bool underline() const { return fontUnderline(); }
- inline QT3_SUPPORT QString family() const { return fontFamily(); }
- inline QT3_SUPPORT int pointSize() const { return (int)(fontPointSize()+0.5); }
-
- inline QT3_SUPPORT bool hasSelectedText() const
- { return textCursor().hasSelection(); }
- inline QT3_SUPPORT QString selectedText() const
- { return textCursor().selectedText(); }
-
- inline QT3_SUPPORT bool isUndoAvailable() const
- { return document()->isUndoAvailable(); }
- inline QT3_SUPPORT bool isRedoAvailable() const
- { return document()->isRedoAvailable(); }
-
- inline QT3_SUPPORT void insert(const QString &text)
- { insertPlainText(text); }
-
- inline QT3_SUPPORT bool isModified() const
- { return document()->isModified(); }
-
- inline QT3_SUPPORT QColor color() const
- { return textColor(); }
-
-public Q_SLOTS:
- inline QT_MOC_COMPAT void setModified(bool m = true)
- { document()->setModified(m); }
-public:
- inline QT3_SUPPORT void undo() const
- { document()->undo(); }
- inline QT3_SUPPORT void redo() const
- { document()->redo(); }
-
-public Q_SLOTS:
- inline QT_MOC_COMPAT void setColor(const QColor &c)
- { setTextColor(c); }
-
-#endif
private:
Q_DISABLE_COPY(QTextEdit)
setWindowTitle(title);
}
-#ifdef QT3_SUPPORT
-/*! \obsolete
- Constructs a QToolBar with the given \a parent and \a name.
-*/
-QToolBar::QToolBar(QWidget *parent, const char *name)
- : QWidget(*new QToolBarPrivate, parent, 0)
-{
- Q_D(QToolBar);
- d->init();
- setObjectName(QString::fromAscii(name));
-}
-#endif
/*!
Destroys the toolbar.
bool event(QEvent *event);
void initStyleOption(QStyleOptionToolBar *option) const;
-#ifdef QT3_SUPPORT
-public:
- QT3_SUPPORT_CONSTRUCTOR QToolBar(QWidget *parent, const char *name);
- inline QT3_SUPPORT void setLabel(const QString &label)
- { setWindowTitle(label); }
- inline QT3_SUPPORT QString label() const
- { return windowTitle(); }
-#endif
private:
Q_DECLARE_PRIVATE(QToolBar)
current item.
*/
-#ifdef QT3_SUPPORT
-/*!
- Constructs a toolbox called \a name with parent \a parent and flags \a f.
-*/
-QToolBox::QToolBox(QWidget *parent, const char *name, Qt::WindowFlags f)
- : QFrame(*new QToolBoxPrivate, parent, f)
-{
- Q_D(QToolBox);
- setObjectName(QString::fromAscii(name));
- d->layout = new QVBoxLayout(this);
- d->layout->setMargin(0);
- setBackgroundRole(QPalette::Button);
-}
-#endif
/*!
Constructs a new toolbox with the given \a parent and the flags, \a f.
void showEvent(QShowEvent *e);
void changeEvent(QEvent *);
-#ifdef QT3_SUPPORT
-public:
- QT3_SUPPORT_CONSTRUCTOR QToolBox(QWidget *parent, const char *name, Qt::WindowFlags f = 0);
- inline QT3_SUPPORT void setItemLabel(int index, const QString &text) { setItemText(index, text); }
- inline QT3_SUPPORT QString itemLabel(int index) const { return itemText(index); }
- inline QT3_SUPPORT QWidget *currentItem() const { return widget(currentIndex()); }
- inline QT3_SUPPORT void setCurrentItem(QWidget *item) { setCurrentIndex(indexOf(item)); }
- inline QT3_SUPPORT void setItemIconSet(int index, const QIcon &icon) { setItemIcon(index, icon); }
- inline QT3_SUPPORT QIcon itemIconSet(int index) const { return itemIcon(index); }
- inline QT3_SUPPORT int removeItem(QWidget *item)
- { int i = indexOf(item); removeItem(i); return i; }
- inline QT3_SUPPORT QWidget *item(int index) const { return widget(index); }
- QT3_SUPPORT void setMargin(int margin) { setContentsMargins(margin, margin, margin, margin); }
- QT3_SUPPORT int margin() const
- { int margin; int dummy; getContentsMargins(&margin, &dummy, &dummy, &dummy); return margin; }
-#endif
private:
Q_DECLARE_PRIVATE(QToolBox)
//workaround for task 177850
QList<QAction *> actionsCopy;
#endif
-#ifdef QT3_SUPPORT
- bool userDefinedPopupDelay;
-#endif
};
#ifndef QT_NO_MENU
d->init();
}
-#ifdef QT3_SUPPORT
-/*!
- Constructs an empty tool button called \a name, with parent \a
- parent.
-*/
-
-QToolButton::QToolButton(QWidget * parent, const char *name)
- : QAbstractButton(*new QToolButtonPrivate, parent)
-{
- Q_D(QToolButton);
- setObjectName(QString::fromAscii(name));
- d->init();
-}
-
-/*!
- Constructs a tool button called \a name, that is a child of \a
- parent.
-
- The tool button will display the given \a icon, with its text
- label and tool tip set to \a textLabel and its status bar message
- set to \a statusTip. It will be connected to the \a slot in
- object \a receiver.
-*/
-
-QToolButton::QToolButton(const QIcon& icon, const QString &textLabel,
- const QString& statusTip,
- QObject * receiver, const char *slot,
- QWidget * parent, const char *name)
- : QAbstractButton(*new QToolButtonPrivate, parent)
-{
- Q_D(QToolButton);
- setObjectName(QString::fromAscii(name));
- d->init();
- setIcon(icon);
- setText(textLabel);
- if (receiver && slot)
- connect(this, SIGNAL(clicked()), receiver, slot);
-#ifndef QT_NO_TOOLTIP
- if (!textLabel.isEmpty())
- setToolTip(textLabel);
-#endif
-#ifndef QT_NO_STATUSTIP
- if (!statusTip.isEmpty())
- setStatusTip(statusTip);
-#else
- Q_UNUSED(statusTip);
-#endif
-}
-
-
-/*!
- Constructs a tool button as an arrow button. The Qt::ArrowType \a
- type defines the arrow direction. Possible values are
- Qt::LeftArrow, Qt::RightArrow, Qt::UpArrow, and Qt::DownArrow.
-
- An arrow button has auto-repeat turned on by default.
-
- The \a parent and \a name arguments are sent to the QWidget
- constructor.
-*/
-QToolButton::QToolButton(Qt::ArrowType type, QWidget *parent, const char *name)
- : QAbstractButton(*new QToolButtonPrivate, parent)
-{
- Q_D(QToolButton);
- setObjectName(QString::fromAscii(name));
- d->init();
- setAutoRepeat(true);
- d->arrowType = type;
-}
-
-#endif
/* Set-up code common to all the constructors */
{
Q_Q(QToolButton);
delay = q->style()->styleHint(QStyle::SH_ToolButton_PopupDelay, 0, q);
-#ifdef QT3_SUPPORT
- userDefinedPopupDelay = false;
-#endif
defaultAction = 0;
#ifndef QT_NO_TOOLBAR
if (qobject_cast<QToolBar*>(parent))
if (QToolBar *toolBar = qobject_cast<QToolBar *>(parentWidget())) {
option->iconSize = toolBar->iconSize();
}
-#ifdef QT3_SUPPORT
- else if (parentWidget()->inherits("Q3ToolBar")) {
- if (!option->iconSize.isValid()) {
- int iconSize = style()->pixelMetric(QStyle::PM_ToolBarIconSize, option, this);
- option->iconSize = d->icon.actualSize(QSize(iconSize, iconSize));
- }
- forceNoText = d->toolButtonStyle == Qt::ToolButtonIconOnly;
- }
-#endif
}
#endif // QT_NO_TOOLBAR
|| e->type() == QEvent::MacSizeChange
#endif
) {
-#ifdef QT3_SUPPORT
- if (!d->userDefinedPopupDelay)
-#endif
d->delay = style()->styleHint(QStyle::SH_ToolButton_PopupDelay, 0, this);
d->setLayoutItemMargins(QStyle::SE_ToolButtonLayoutItem);
}
return false;
}
-#ifdef QT3_SUPPORT
-
-/*!
- Use icon() instead.
-*/
-QIcon QToolButton::onIconSet() const
-{
- return icon();
-}
-
-/*!
- Use icon() instead.
-*/
-QIcon QToolButton::offIconSet() const
-{
- return icon();
-}
-
-
-/*!
- \obsolete
-
- Use setIcon() instead.
-*/
-void QToolButton::setOnIconSet(const QIcon& set)
-{
- setIcon(set);
-}
-
-/*!
- \obsolete
-
- Use setIcon() instead.
-*/
-void QToolButton::setOffIconSet(const QIcon& set)
-{
- setIcon(set);
-}
-
-
-/*! \overload
- \obsolete
-
- Since Qt 3.0, QIcon contains both the On and Off icons.
-
- For ease of porting, this function ignores the \a on parameter and
- sets the \l{QAbstractButton::icon} {icon} property. If you relied on
- the \a on parameter, you probably want to update your code to use
- the QIcon On/Off mechanism.
-
- \sa icon QIcon::State
-*/
-
-void QToolButton::setIconSet(const QIcon & set, bool /* on */)
-{
- QAbstractButton::setIcon(set);
-}
-
-/*! \overload
- \obsolete
-
- Since Qt 3.0, QIcon contains both the On and Off icons.
-
- For ease of porting, this function ignores the \a on parameter and
- returns the \l{QAbstractButton::icon} {icon} property. If you relied
- on the \a on parameter, you probably want to update your code to use
- the QIcon On/Off mechanism.
-*/
-QIcon QToolButton::iconSet(bool /* on */) const
-{
- return QAbstractButton::icon();
-}
-
-#endif
#ifndef QT_NO_MENU
/*!
}
#endif // QT_NO_MENU
-#ifdef QT3_SUPPORT
-/*!
- \fn void QToolButton::setPopupDelay(int delay)
-
- Use the style hint QStyle::SH_ToolButton_PopupDelay instead.
-*/
-void QToolButton::setPopupDelay(int delay)
-{
- Q_D(QToolButton);
- d->userDefinedPopupDelay = true;
- d->delay = delay;
-
- update();
-}
-
-/*!
- Use the style hint QStyle::SH_ToolButton_PopupDelay instead.
-*/
-int QToolButton::popupDelay() const
-{
- Q_D(const QToolButton);
- return d->delay;
-}
-#endif
#ifndef QT_NO_MENU
/*! \enum QToolButton::ToolButtonPopupMode
#endif
Q_PRIVATE_SLOT(d_func(), void _q_actionTriggered())
-#ifdef QT3_SUPPORT
-public:
- enum TextPosition {
- BesideIcon,
- BelowIcon
- , Right = BesideIcon,
- Under = BelowIcon
- };
-
- QT3_SUPPORT_CONSTRUCTOR QToolButton(QWidget * parent, const char* name);
- QT3_SUPPORT_CONSTRUCTOR QToolButton(Qt::ArrowType type, QWidget *parent, const char* name);
- QT3_SUPPORT_CONSTRUCTOR QToolButton( const QIcon& s, const QString &textLabel,
- const QString& grouptext,
- QObject * receiver, const char* slot,
- QWidget * parent, const char* name=0 );
- inline QT3_SUPPORT void setPixmap(const QPixmap &pixmap) { setIcon(static_cast<QIcon>(pixmap)); }
- QT3_SUPPORT void setOnIconSet(const QIcon&);
- QT3_SUPPORT void setOffIconSet(const QIcon&);
- inline QT3_SUPPORT void setIconSet(const QIcon &icon){setIcon(icon);}
- QT3_SUPPORT void setIconSet(const QIcon &, bool on);
- inline QT3_SUPPORT void setTextLabel(const QString &text, bool tooltip = true) {
- setText(text);
-#ifndef QT_NO_TOOLTIP
- if (tooltip)
- setToolTip(text);
-#else
- Q_UNUSED(tooltip);
-#endif
- }
- inline QT3_SUPPORT QString textLabel() const { return text(); }
- QT3_SUPPORT QIcon onIconSet() const;
- QT3_SUPPORT QIcon offIconSet() const;
- QT3_SUPPORT QIcon iconSet(bool on) const;
- inline QT3_SUPPORT QIcon iconSet() const { return icon(); }
- inline QT3_SUPPORT void openPopup() { showMenu(); }
- inline QT3_SUPPORT void setPopup(QMenu* popup) {setMenu(popup); }
- inline QT3_SUPPORT QMenu* popup() const { return menu(); }
- inline QT3_SUPPORT bool usesBigPixmap() const { return iconSize().height() > 22; }
- inline QT3_SUPPORT bool usesTextLabel() const { return toolButtonStyle() != Qt::ToolButtonIconOnly; }
- inline QT3_SUPPORT TextPosition textPosition() const
- { return toolButtonStyle() == Qt::ToolButtonTextUnderIcon ? BelowIcon : BesideIcon; }
- QT3_SUPPORT void setPopupDelay(int delay);
- QT3_SUPPORT int popupDelay() const;
-
-public Q_SLOTS:
- QT_MOC_COMPAT void setUsesBigPixmap(bool enable)
- { setIconSize(enable?QSize(32,32):QSize(22,22)); }
- QT_MOC_COMPAT void setUsesTextLabel(bool enable)
- { setToolButtonStyle(enable?Qt::ToolButtonTextUnderIcon : Qt::ToolButtonIconOnly); }
- QT_MOC_COMPAT void setTextPosition(QToolButton::TextPosition pos)
- { setToolButtonStyle(pos == BesideIcon ? Qt::ToolButtonTextBesideIcon : Qt::ToolButtonTextUnderIcon); }
-
-#endif
};
#endif // QT_NO_TOOLBUTTON
d->init();
}
-#ifdef QT3_SUPPORT
-/*!
- Use one of the constructors that doesn't take the \a name
- argument and then use setObjectName() instead.
-*/
-QWorkspace::QWorkspace(QWidget *parent, const char *name)
- : QWidget(*new QWorkspacePrivate, parent, 0)
-{
- Q_D(QWorkspace);
- setObjectName(QString::fromAscii(name));
- d->init();
-}
-#endif // QT3_SUPPORT
/*!
\internal
}
-#ifdef QT3_SUPPORT
-/*!
- Sets the background color to \a c.
- Use setBackground() instead.
-*/
-void QWorkspace::setPaletteBackgroundColor(const QColor & c)
-{
- setBackground(c);
-}
-
-/*!
- Sets the background pixmap to \a pm.
- Use setBackground() instead.
-*/
-void QWorkspace::setPaletteBackgroundPixmap(const QPixmap & pm)
-{
- setBackground(pm);
-}
-#endif // QT3_SUPPORT
/*!
\property QWorkspace::background
bool scrollBarsEnabled() const;
void setScrollBarsEnabled(bool enable);
-#ifdef QT3_SUPPORT
- QT3_SUPPORT_CONSTRUCTOR QWorkspace(QWidget* parent, const char* name);
- QT3_SUPPORT void setPaletteBackgroundColor(const QColor &);
- QT3_SUPPORT void setPaletteBackgroundPixmap(const QPixmap &);
-#endif
void setBackground(const QBrush &background);
QBrush background() const;