- sh -e /etc/init.d/xvfb start
- sleep 3
script:
- - if [ "$CXX" = "clang++" ];then cmake -DENABLE_TESTING=TRUE -Wno-dev -DMYSQL_LIBRARIES:STRING="-lmysqld -lcrypt -laio" ;fi
- - if [ "$CXX" = "g++" ];then cmake -DENABLE_TESTING=TRUE -DKATIE_ALLINONE=ON -Wno-dev -DMYSQL_LIBRARIES:STRING="-lmysqld -lcrypt -laio" ;fi
+ - if [ "$CXX" == "clang++" ];then cmake -DENABLE_TESTING=TRUE -Wno-dev -DMYSQL_LIBRARIES:STRING="-lmysqld -lcrypt -laio" ;fi
+ - if [ "$CXX" == "g++" ];then cmake -DENABLE_TESTING=TRUE -DKATIE_ALLINONE=ON -Wno-dev -DMYSQL_LIBRARIES:STRING="-lmysqld -lcrypt -laio" ;fi
- make
# the tests/benchmarks take more then 1-hour and Travis times out
# - ctest -V
Q_PRIVATE_SLOT(d_func(), void _q_newColorTypedIn(QRgb rgb))
Q_PRIVATE_SLOT(d_func(), void _q_newCustom(int, int))
Q_PRIVATE_SLOT(d_func(), void _q_newStandard(int, int))
-#if defined(Q_WS_MAC)
- Q_PRIVATE_SLOT(d_func(), void _q_macRunNativeAppModalPanel())
-#endif
friend class QColorShower;
};
#ifndef QT_NO_ACCESSIBILITY
#include "qaccessible.h"
#endif
-#if defined(Q_WS_WINCE)
-#include "qt_windows.h"
-#include "qmenubar.h"
-#include "qpointer.h"
-#include "qguifunctions_wince.h"
-extern bool qt_wince_is_mobile(); //defined in qguifunctions_wce.cpp
-extern bool qt_wince_is_smartphone(); //is defined in qguifunctions_wce.cpp
-#elif defined(Q_WS_X11)
+#if defined(Q_WS_X11)
# include "../kernel/qt_x11_p.h"
-#elif defined(Q_OS_BLACKBERRY)
-# include "qmessagebox.h"
#endif
: QWidget(*new QDialogPrivate, parent,
f | ((f & Qt::WindowType_Mask) == 0 ? Qt::Dialog : Qt::WindowType(0)))
{
-#ifdef Q_WS_WINCE
- if (!qt_wince_is_smartphone())
- setWindowFlags(windowFlags() | Qt::WindowOkButtonHint | QFlag(qt_wince_is_mobile() ? 0 : Qt::WindowCancelButtonHint));
-#endif
-
}
QDialog::QDialog(QDialogPrivate &dd, QWidget *parent, Qt::WindowFlags f)
: QWidget(dd, parent, f | ((f & Qt::WindowType_Mask) == 0 ? Qt::Dialog : Qt::WindowType(0)))
{
-#ifdef Q_WS_WINCE
- if (!qt_wince_is_smartphone())
- setWindowFlags(windowFlags() | Qt::WindowOkButtonHint | QFlag(qt_wince_is_mobile() ? 0 : Qt::WindowCancelButtonHint));
-#endif
-
}
/*!
// open() changed the window modality and the user didn't touch it afterwards; restore it
q->setWindowModality(Qt::WindowModality(resetModalityTo));
q->setAttribute(Qt::WA_SetWindowModality, wasModalitySet);
-#ifdef Q_WS_MAC
- Q_ASSERT(resetModalityTo != Qt::WindowModal);
- q->setParent(q->parentWidget(), Qt::Dialog);
-#endif
}
resetModalityTo = -1;
}
-#if defined(Q_WS_WINCE)
-#ifdef Q_WS_WINCE_WM
-void QDialogPrivate::_q_doneAction()
-{
- //Done...
- QApplication::postEvent(q_func(), new QEvent(QEvent::OkRequest));
-}
-#endif
-
-/*!
- \reimp
-*/
-bool QDialog::event(QEvent *e)
-{
- bool result = QWidget::event(e);
-#ifdef Q_WS_WINCE
- if (e->type() == QEvent::OkRequest) {
- accept();
- result = true;
- }
-#endif
- return result;
-}
-#endif
-
/*!
In general returns the modal dialog's result code, \c Accepted or \c Rejected.
d->wasModalitySet = testAttribute(Qt::WA_SetWindowModality);
setWindowModality(Qt::WindowModal);
setAttribute(Qt::WA_SetWindowModality, false);
-#ifdef Q_WS_MAC
- setParent(parentWidget(), Qt::Sheet);
-#endif
}
setResult(0);
setAttribute(Qt::WA_ShowModal, true);
setResult(0);
-//On Windows Mobile we create an empty menu to hide the current menu
-#ifdef Q_WS_WINCE_WM
-#ifndef QT_NO_MENUBAR
- QMenuBar *menuBar = 0;
- if (!findChild<QMenuBar *>())
- menuBar = new QMenuBar(this);
- if (qt_wince_is_smartphone()) {
- QAction *doneAction = new QAction(tr("Done"), this);
- menuBar->setDefaultAction(doneAction);
- connect(doneAction, SIGNAL(triggered()), this, SLOT(_q_doneAction()));
- }
-#endif //QT_NO_MENUBAR
-#endif //Q_WS_WINCE_WM
-
- bool showSystemDialogFullScreen = false;
-
-
-#ifdef Q_OS_BLACKBERRY
- if (!qobject_cast<QMessageBox *>(this))
- showSystemDialogFullScreen = true;
-#endif // Q_OS_BLACKBERRY
-
- if (showSystemDialogFullScreen) {
- setWindowFlags(windowFlags() | Qt::WindowSoftkeysVisibleHint);
- setWindowState(Qt::WindowFullScreen);
- }
show();
-#ifdef Q_WS_MAC
- d->mac_nativeDialogModalHelp();
-#endif
-
QEventLoop eventLoop;
d->eventLoop = &eventLoop;
QPointer<QDialog> guard = this;
int res = result();
if (deleteOnClose)
delete this;
-#ifdef Q_WS_WINCE_WM
-#ifndef QT_NO_MENUBAR
- else if (menuBar)
- delete menuBar;
-#endif //QT_NO_MENUBAR
-#endif //Q_WS_WINCE_WM
return res;
}
// Calls reject() if Escape is pressed. Simulates a button
// click for the default button if Enter is pressed. Move focus
// for the arrow keys. Ignore the rest.
-#ifdef Q_WS_MAC
- if(e->modifiers() == Qt::ControlModifier && e->key() == Qt::Key_Period) {
- reject();
- } else
-#endif
if (!e->modifiers() || (e->modifiers() & Qt::KeypadModifier && e->key() == Qt::Key_Enter)) {
switch (e->key()) {
case Qt::Key_Enter:
if (d->eventLoop)
d->eventLoop->exit();
}
-#ifdef Q_WS_WIN
- if (d->mainDef && isActiveWindow()) {
- BOOL snapToDefault = false;
- if (SystemParametersInfo(SPI_GETSNAPTODEFBUTTON, 0, &snapToDefault, 0)) {
- if (snapToDefault)
- QCursor::setPos(d->mainDef->mapToGlobal(d->mainDef->rect().center()));
- }
- }
-#endif
}
/*!\reimp */
protected:
QDialog(QDialogPrivate &, QWidget *parent, Qt::WindowFlags f = 0);
-#if defined(Q_WS_WINCE)
- bool event(QEvent *e);
-#endif
void keyPressEvent(QKeyEvent *);
void closeEvent(QCloseEvent *);
void showEvent(QShowEvent *);
private:
Q_DECLARE_PRIVATE(QDialog)
Q_DISABLE_COPY(QDialog)
-
-
-#ifdef Q_WS_WINCE_WM
- Q_PRIVATE_SLOT(d_func(), void _q_doneAction())
-#endif
};
QT_END_NAMESPACE
void hideDefault();
void resetModalitySetByOpen();
-#ifdef Q_WS_WINCE_WM
- void _q_doneAction();
-#endif
-
-#ifdef Q_WS_MAC
- virtual void mac_nativeDialogModalHelp() {}
-#endif
-
int rescode;
int resetModalityTo;
bool wasModalitySet;
#include <stdio.h>
#include <stdlib.h>
-#ifdef Q_WS_WINCE
-extern bool qt_wince_is_mobile(); //defined in qguifunctions_wince.cpp
-extern bool qt_wince_is_high_dpi(); //defined in qguifunctions_wince.cpp
-
-#include "qguifunctions_wince.h"
-#endif
-
-
QT_BEGIN_NAMESPACE
class QErrorMessagePrivate : public QDialogPrivate
QSize QErrorMessageTextView::minimumSizeHint() const
{
-#ifdef Q_WS_WINCE
- if (qt_wince_is_mobile())
- if (qt_wince_is_high_dpi())
- return QSize(200, 200);
- else
- return QSize(100, 100);
- else
- return QSize(70, 70);
-#else
return QSize(50, 50);
-#endif
}
QSize QErrorMessageTextView::sizeHint() const
{
-#ifdef Q_WS_WINCE
- if (qt_wince_is_mobile())
- if (qt_wince_is_high_dpi())
- return QSize(400, 200);
- else
- return QSize(320, 120);
- else
- return QSize(300, 100);
-#else
-
return QSize(250, 75);
-#endif //Q_WS_WINCE
}
/*!
grid->addWidget(d->again, 1, preferredTextColumn, Qt::AlignTop);
d->ok = new QPushButton(this);
-#if defined(Q_WS_WINCE) || defined(Q_WS_S60)
- d->ok->setFixedSize(0,0);
-#endif
connect(d->ok, SIGNAL(clicked()), this, SLOT(accept()));
d->ok->setFocus();
grid->addWidget(d->ok, 2, 0, 1, 2, Qt::AlignCenter);
{
QStringList files;
for (int i=0; i<filesToFix.size(); ++i) {
- QString name = toInternal(filesToFix.at(i));
+ QString name = filesToFix.at(i);
QFileInfo info(name);
// if the filename has no suffix, add the default suffix
if (!defaultSuffix.isEmpty() && !info.isDir() && name.lastIndexOf(QLatin1Char('.')) == -1)
args.mode = (options & ShowDirsOnly ? DirectoryOnly : Directory);
args.options = options;
-#if defined(Q_WS_WIN)
- if (qt_use_native_dialogs && !(args.options & DontUseNativeDialog) && (options & ShowDirsOnly)
-#if defined(Q_WS_WINCE)
- && qt_priv_ptr_valid
-#endif
- ) {
- return qt_win_get_existing_directory(args);
- }
-#endif
-
// create a qt dialog
QFileDialog dialog(args);
if (dialog.exec() == QDialog::Accepted) {
QLineEdit *lineEdit() const;
int maxNameLength(const QString &path) {
-#if defined(Q_OS_UNIX)
return ::pathconf(QFile::encodeName(path).data(), _PC_NAME_MAX);
-#elif defined(Q_OS_WIN)
-#ifndef Q_OS_WINCE
- DWORD maxLength;
- QString drive = path.left(3);
- if (::GetVolumeInformation(reinterpret_cast<const wchar_t *>(drive.utf16()), NULL, 0, NULL, &maxLength, NULL, NULL, 0) == FALSE)
- return -1;
- return maxLength;
-#else
- Q_UNUSED(path);
- return MAX_PATH;
-#endif //Q_OS_WINCE
-#else
- Q_UNUSED(path);
-#endif
- return -1;
}
QString basename(const QString &path) const
QAbstractItemView *currentView() const;
- static inline QString toInternal(const QString &path)
- {
-#if defined(Q_FS_FAT) || defined(Q_OS_OS2EMX)
- QString n(path);
- for (int i = 0; i < (int)n.length(); ++i)
- if (n[i] == QLatin1Char('\\')) n[i] = QLatin1Char('/');
-#if defined(Q_OS_WINCE)
- if ((n.size() > 1) && (n.startsWith(QLatin1String("//"))))
- n = n.mid(1);
-#endif
- return n;
-#else // the compile should optimize away this
- return path;
-#endif
- }
-
void setLastVisitedDirectory(const QString &dir);
void retranslateWindowTitle();
void retranslateStrings();
}
QString fileName;
-#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
- QString volumeName;
-#endif
inline qint64 size() const { if (info && !info->isDir()) return info->size(); return 0; }
inline QString type() const { if (info) return info->displayType; return QLatin1String(""); }
#include <QtGui/qfontmetrics.h>
#include <QtGui/qclipboard.h>
-#ifdef Q_WS_WINCE
-extern bool qt_wince_is_mobile(); //defined in qguifunctions_wince.cpp
-extern bool qt_wince_is_smartphone();//defined in qguifunctions_wince.cpp
-extern bool qt_wince_is_pocket_pc(); //defined in qguifunctions_wince.cpp
-
-#include "qguifunctions_wince.h"
-#endif
-
QT_BEGIN_NAMESPACE
enum DetailButtonLabel { ShowLabel = 0, HideLabel = 1 };
int layoutMinimumWidth();
void retranslateStrings();
-#ifdef Q_WS_WINCE
- void hideSpecial();
-#endif
-
static QMessageBox::StandardButton showNewMessageBox(QWidget *parent,
QMessageBox::Icon icon, const QString& title, const QString& text,
QMessageBox::StandardButtons buttons, QMessageBox::StandardButton defaultButton);
label->setTextInteractionFlags(Qt::TextInteractionFlags(q->style()->styleHint(QStyle::SH_MessageBox_TextInteractionFlags, 0, q)));
label->setAlignment(Qt::AlignVCenter | Qt::AlignLeft);
label->setOpenExternalLinks(true);
-#if defined(Q_WS_MAC)
- label->setContentsMargins(16, 0, 0, 0);
-#else
label->setContentsMargins(2, 0, 0, 0);
label->setIndent(9);
-#endif
icon = QMessageBox::NoIcon;
iconLabel = new QLabel;
iconLabel->setObjectName(QLatin1String("qt_msgboxex_icon_label"));
q, SLOT(_q_buttonClicked(QAbstractButton*)));
QGridLayout *grid = new QGridLayout;
-#ifndef Q_WS_MAC
const int preferredIconColumn = 0;
const int preferredTextColumn = 1;
grid->addWidget(iconLabel, 0, preferredIconColumn, 2, 1, Qt::AlignTop);
grid->addWidget(label, 0, preferredTextColumn, 1, 1);
// -- leave space for information label --
grid->addWidget(buttonBox, 2, 0, 1, 2);
-#else
- grid->setMargin(0);
- grid->setVerticalSpacing(8);
- grid->setHorizontalSpacing(0);
- q->setContentsMargins(24, 15, 24, 20);
- grid->addWidget(iconLabel, 0, 0, 2, 1, Qt::AlignTop | Qt::AlignLeft);
- grid->addWidget(label, 0, 1, 1, 1);
- // -- leave space for information label --
- grid->setRowStretch(1, 100);
- grid->setRowMinimumHeight(2, 6);
- grid->addWidget(buttonBox, 3, 1, 1, 1);
-#endif
grid->setSizeConstraint(QLayout::SetNoConstraint);
q->setLayout(grid);
}
q->setModal(true);
-#ifdef Q_WS_MAC
- QFont f = q->font();
- f.setBold(true);
- label->setFont(f);
-#endif
retranslateStrings();
}
if (!q->isVisible())
return;
- QSize screenSize = QApplication::desktop()->availableGeometry(QCursor::pos()).size();
-#if defined(Q_WS_WINCE)
- // the width of the screen, less the window border.
- int hardLimit = screenSize.width() - (q->frameGeometry().width() - q->geometry().width());
-#else
+ const QSize screenSize = QApplication::desktop()->availableGeometry(QCursor::pos()).size();
int hardLimit = qMin(screenSize.width() - 480, 1000); // can never get bigger than this
// on small screens allows the messagebox be the same size as the screen
if (screenSize.width() <= 1024)
hardLimit = screenSize.width();
-#endif
-#ifdef Q_WS_MAC
- int softLimit = qMin(screenSize.width()/2, 420);
-#else
- // note: ideally on windows, hard and soft limits but it breaks compat
-#ifndef Q_WS_WINCE
- int softLimit = qMin(screenSize.width()/2, 500);
-#else
- int softLimit = qMin(screenSize.width() * 3 / 4, 500);
-#endif //Q_WS_WINCE
-#endif
+ const int softLimit = qMin(screenSize.width()/2, 500);
if (informativeLabel)
informativeLabel->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Ignored);
QCoreApplication::removePostedEvents(q, QEvent::LayoutRequest);
}
-
-#ifdef Q_WS_WINCE
-/*!
- \internal
- Hides special buttons which are rather shown in the title bar
- on WinCE, to conserve screen space.
-*/
-
-void QMessageBoxPrivate::hideSpecial()
-{
- Q_Q(QMessageBox);
- QList<QPushButton*> list = q->findChildren<QPushButton*>();
- for (int i=0; i<list.size(); ++i) {
- QPushButton *pb = list.at(i);
- QString text = pb->text();
- text.remove(QChar::fromLatin1('&'));
- if (text == QApplication::translate("QMessageBox", "OK" ))
- pb->setFixedSize(0,0);
- }
-}
-#endif
-
int QMessageBoxPrivate::execReturnCode(QAbstractButton *button)
{
int ret = buttonBox->standardButton(button);
case QEvent::LanguageChange:
d_func()->retranslateStrings();
break;
-#ifdef Q_WS_WINCE
- case QEvent::OkRequest:
- case QEvent::HelpRequest: {
- QString bName =
- (e->type() == QEvent::OkRequest)
- ? QApplication::translate("QMessageBox", "OK")
- : QApplication::translate("QMessageBox", "Help");
- QList<QPushButton*> list = findChildren<QPushButton*>();
- for (int i=0; i<list.size(); ++i) {
- QPushButton *pb = list.at(i);
- if (pb->text() == bName) {
- if (pb->isEnabled())
- pb->click();
- return pb->isEnabled();
- }
- }
- }
-#endif
default:
break;
}
/*!
\reimp
*/
-void QMessageBox::resizeEvent(QResizeEvent *event)
-{
- QDialog::resizeEvent(event);
-}
-
-/*!
- \reimp
-*/
void QMessageBox::closeEvent(QCloseEvent *e)
{
Q_D(QMessageBox);
}
case QEvent::FontChange:
case QEvent::ApplicationFontChange:
-#ifdef Q_WS_MAC
- {
- QFont f = font();
- f.setBold(true);
- d->label->setFont(f);
- }
-#endif
default:
break;
}
void QMessageBox::keyPressEvent(QKeyEvent *e)
{
Q_D(QMessageBox);
- if (e->key() == Qt::Key_Escape
-#ifdef Q_WS_MAC
- || (e->modifiers() == Qt::ControlModifier && e->key() == Qt::Key_Period)
-#endif
- ) {
- if (d->detectedEscapeButton) {
-#ifdef Q_WS_MAC
- d->detectedEscapeButton->animateClick();
-#else
- d->detectedEscapeButton->click();
-#endif
- }
- return;
- }
-
-#if defined (Q_OS_WIN) && !defined(QT_NO_CLIPBOARD) && !defined(QT_NO_SHORTCUT)
- if (e == QKeySequence::Copy) {
- QString separator = QString::fromLatin1("---------------------------\n");
- QString textToCopy = separator;
- separator.prepend(QLatin1Char('\n'));
- textToCopy += windowTitle() + separator; // title
- textToCopy += d->label->text() + separator; // text
-
- if (d->informativeLabel)
- textToCopy += d->informativeLabel->text() + separator;
-
- QString buttonTexts;
- QList<QAbstractButton *> buttons = d->buttonBox->buttons();
- for (int i = 0; i < buttons.count(); i++) {
- buttonTexts += buttons[i]->text() + QLatin1String(" ");
- }
- textToCopy += buttonTexts + separator;
-
- QApplication::clipboard()->setText(textToCopy);
- return;
+ if (e->key() == Qt::Key_Escape) {
+ if (d->detectedEscapeButton) {
+ d->detectedEscapeButton->click();
}
-#endif //QT_NO_SHORTCUT QT_NO_CLIPBOARD Q_OS_WIN
+ return;
+ }
#ifndef QT_NO_SHORTCUT
if (!(e->modifiers() & Qt::AltModifier)) {
QDialog::keyPressEvent(e);
}
-#ifdef Q_WS_WINCE
-/*!
- \reimp
-*/
-void QMessageBox::setVisible(bool visible)
-{
- Q_D(QMessageBox);
- if (visible)
- d->hideSpecial();
- QDialog::setVisible(visible);
-}
-#endif
-
-
/*!
\overload
Q_D(QMessageBox);
if (d->autoAddOkButton) {
addButton(Ok);
-#if defined(Q_WS_WINCE)
- d->hideSpecial();
-#endif
}
if (d->detailsButton)
addButton(d->detailsButton, QMessageBox::ActionRole);
#ifndef QT_NO_ACCESSIBILITY
QAccessible::updateAccessibility(this, 0, QAccessible::Alert);
#endif
-#ifdef Q_WS_WIN
- HMENU systemMenu = GetSystemMenu((HWND)winId(), FALSE);
- if (!d->detectedEscapeButton) {
- EnableMenuItem(systemMenu, SC_CLOSE, MF_BYCOMMAND|MF_GRAYED);
- }
- else {
- EnableMenuItem(systemMenu, SC_CLOSE, MF_BYCOMMAND|MF_ENABLED);
- }
-#endif
QDialog::showEvent(e);
}
*/
void QMessageBox::about(QWidget *parent, const QString &title, const QString &text)
{
-#ifdef Q_WS_MAC
- static QPointer<QMessageBox> oldMsgBox;
-
- if (oldMsgBox && oldMsgBox->text() == text) {
- oldMsgBox->show();
- oldMsgBox->raise();
- oldMsgBox->activateWindow();
- return;
- }
-#endif
-
- QMessageBox *msgBox = new QMessageBox(Information, title, text, 0, parent
-#ifdef Q_WS_MAC
- , Qt::WindowTitleHint | Qt::WindowSystemMenuHint
-#endif
- );
+ QMessageBox *msgBox = new QMessageBox(Information, title, text, 0, parent);
msgBox->setAttribute(Qt::WA_DeleteOnClose);
QIcon icon = msgBox->windowIcon();
QSize size = icon.actualSize(QSize(64, 64));
msgBox->setIconPixmap(icon.pixmap(size));
- // should perhaps be a style hint
-#ifdef Q_WS_MAC
- oldMsgBox = msgBox;
-#if 0
- // ### doesn't work until close button is enabled in title bar
- msgBox->d_func()->autoAddOkButton = false;
-#else
- msgBox->d_func()->buttonBox->setCenterButtons(true);
-#endif
- msgBox->show();
-#else
msgBox->exec();
-#endif
}
/*!
*/
void QMessageBox::aboutQt(QWidget *parent, const QString &title)
{
-#ifdef Q_WS_MAC
- static QPointer<QMessageBox> oldMsgBox;
-
- if (oldMsgBox) {
- oldMsgBox->show();
- oldMsgBox->raise();
- oldMsgBox->activateWindow();
- return;
- }
-#endif
-
QString translatedTextAboutQtCaption;
translatedTextAboutQtCaption = QMessageBox::tr(
"<h3>About Qt</h3>"
QPixmap pm(QLatin1String(":/trolltech/qmessagebox/images/qtlogo-64.png"));
if (!pm.isNull())
msgBox->setIconPixmap(pm);
-#if defined(Q_WS_WINCE)
- msgBox->setDefaultButton(msgBox->addButton(QMessageBox::Ok));
-#endif
- // should perhaps be a style hint
-#ifdef Q_WS_MAC
- oldMsgBox = msgBox;
-#if 0
- // ### doesn't work until close button is enabled in title bar
- msgBox->d_func()->autoAddOkButton = false;
-#else
- msgBox->d_func()->buttonBox->setCenterButtons(true);
-#endif
- msgBox->show();
-#else
msgBox->exec();
-#endif
}
/////////////////////////////////////////////////////////////////////////////////////////
layout()->removeWidget(d->informativeLabel);
delete d->informativeLabel;
d->informativeLabel = 0;
-#ifndef Q_WS_MAC
d->label->setContentsMargins(2, 0, 0, 0);
-#endif
d->updateSize();
return;
}
label->setAlignment(Qt::AlignTop | Qt::AlignLeft);
label->setOpenExternalLinks(true);
label->setWordWrap(true);
-#ifndef Q_WS_MAC
d->label->setContentsMargins(2, 0, 0, 0);
label->setContentsMargins(2, 0, 0, 6);
label->setIndent(9);
-#else
- label->setContentsMargins(16, 0, 0, 0);
- // apply a smaller font the information label on the mac
- label->setFont(qt_app_fonts_hash()->value("QTipLabel"));
-#endif
label->setWordWrap(true);
QGridLayout *grid = static_cast<QGridLayout *>(layout());
-#if defined(Q_WS_MAEMO_5)
- label->hide();
- QTextBrowser *textBrowser = new QTextBrowser(this);
- textBrowser->setOpenExternalLinks(true);
- const int preferredTextColumn = 1;
- grid->addWidget(textBrowser, 1, preferredTextColumn, 1, 1);
- d->textBrowser = textBrowser;
-#else
grid->addWidget(label, 1, 1, 1, 1);
-#endif
d->informativeLabel = label;
}
d->informativeLabel->setText(text);
-#if defined(Q_WS_MAEMO_5)
- //We need to put the informative label inside textBrowser to enable scrolling of long texts.
- d->textBrowser->setText(d->informativeLabel->text());
-#endif
-
d->updateSize();
}
/*!
\since 4.2
- This function shadows QWidget::setWindowTitle().
-
- Sets the title of the message box to \a title. On Mac OS X,
- the window title is ignored (as required by the Mac OS X
- Guidelines).
-*/
-void QMessageBox::setWindowTitle(const QString &title)
-{
- // Message boxes on the mac do not have a title
-#ifndef Q_WS_MAC
- QDialog::setWindowTitle(title);
-#else
- Q_UNUSED(title);
-#endif
-}
-
-
-/*!
- \since 4.2
-
This function shadows QWidget::setWindowModality().
Sets the modality of the message box to \a windowModality.
QPushButton *addButton(StandardButton button);
void removeButton(QAbstractButton *button);
-#ifdef Q_WS_WINCE
- void setVisible(bool visible);
-#endif
-
#ifdef Q_NO_USING_KEYWORD
void open() { QDialog::open(); }
#else
void setDetailedText(const QString &text);
#endif
- void setWindowTitle(const QString &title);
void setWindowModality(Qt::WindowModality windowModality);
static QPixmap standardIcon(Icon icon);
protected:
bool event(QEvent *e);
- void resizeEvent(QResizeEvent *event);
void showEvent(QShowEvent *event);
void closeEvent(QCloseEvent *event);
void keyPressEvent(QKeyEvent *event);
void setOptions(PageSetupDialogOptions options);
PageSetupDialogOptions options() const;
-#if defined(Q_WS_MAC) || defined(Q_OS_WIN)
- virtual void setVisible(bool visible);
-#endif
virtual int exec();
#ifdef Q_NO_USING_KEYWORD
~QPrintDialog();
int exec();
-#if defined (Q_OS_UNIX)
virtual void accept();
-#endif
void done(int result);
void setOptions(PrintDialogOptions options);
PrintDialogOptions options() const;
-#if defined(Q_OS_UNIX)
void setVisible(bool visible);
-#endif
#ifdef Q_NO_USING_KEYWORD
void open() { QDialog::open(); }
private:
Q_PRIVATE_SLOT(d_func(), void _q_chbPrintLastFirstToggled(bool))
-#if defined(Q_OS_UNIX) && !defined(Q_OS_MAC)
Q_PRIVATE_SLOT(d_func(), void _q_collapseOrExpandDialog())
-#endif
-# if defined(Q_OS_UNIX) && !defined(Q_OS_MAC) && !defined(QT_NO_MESSAGEBOX)
+#if !defined(QT_NO_MESSAGEBOX)
Q_PRIVATE_SLOT(d_func(), void _q_checkFields())
-# endif
+#endif
friend class QUnixPrintWidget;
};
public:
QGraphicsObject(QGraphicsItem *parent = 0);
- // ### Qt 5: Disambiguate
-#ifdef Q_NO_USING_KEYWORD
- const QObjectList &children() const { return QObject::children(); }
-#else
- using QObject::children;
-#endif
-
#ifndef QT_NO_GESTURES
void grabGesture(Qt::GestureType type, Qt::GestureFlags flags = Qt::GestureFlags());
void ungrabGesture(Qt::GestureType type);
return true;
}
-#ifdef Q_NO_USING_KEYWORD
-/*!
- \fn const QObjectList &QGraphicsWidget::children() const
- \internal
-
- This function returns the same value as QObject::children(). It's
- provided to differentiate between the obsolete member
- QGraphicsItem::children() and QObject::children(). QGraphicsItem now
- provides childItems() instead.
-*/
-#endif
-
#if 0
void QGraphicsWidget::dumpFocusChain()
{
void dumpFocusChain();
#endif
- // ### Qt 5: Disambiguate
-#ifdef Q_NO_USING_KEYWORD
- const QObjectList &children() const { return QObject::children(); }
-#else
- using QObject::children;
-#endif
-
Q_SIGNALS:
void geometryChanged();
void layoutChanged();
#include "qpaintengine.h"
#include "qthread.h"
-#ifdef Q_WS_MAC
-# include "qt_mac_p.h"
-#endif
-
#if defined(Q_WS_X11)
# include "qx11info_x11.h"
# include "qt_x11_p.h"
{
#if defined(Q_WS_X11)
return QX11Info::appDepth();
-#elif defined(Q_WS_WINCE)
- return QColormap::instance().depth();
-#elif defined(Q_WS_WIN)
- return 32; // XXX
-#elif defined(Q_WS_MAC)
- return 32;
#endif
}
# endif
#endif
-#ifdef Q_OS_WINCE
-#define CALLBACK_CALL_TYPE __cdecl
-#else
-#define CALLBACK_CALL_TYPE
-#endif
-
QT_BEGIN_NAMESPACE
#if defined(Q_OS_WINCE) && defined(STANDARDSHELL_UI_MODEL)
float gamma;
};
-static
-void CALLBACK_CALL_TYPE iod_read_fn(png_structp png_ptr, png_bytep data, png_size_t length)
+static void iod_read_fn(png_structp png_ptr, png_bytep data, png_size_t length)
{
QPngHandlerPrivate *d = (QPngHandlerPrivate *)png_get_io_ptr(png_ptr);
QIODevice *in = d->q->device();
}
-static
-void CALLBACK_CALL_TYPE qpiw_write_fn(png_structp png_ptr, png_bytep data, png_size_t length)
+static void qpiw_write_fn(png_structp png_ptr, png_bytep data, png_size_t length)
{
QPNGImageWriter* qpiw = (QPNGImageWriter*)png_get_io_ptr(png_ptr);
QIODevice* out = qpiw->device();
}
-static
-void CALLBACK_CALL_TYPE qpiw_flush_fn(png_structp /* png_ptr */)
+static void qpiw_flush_fn(png_structp /* png_ptr */)
{
}
#if defined(Q_C_CALLBACKS)
extern "C" {
#endif
-static void CALLBACK_CALL_TYPE qt_png_warning(png_structp /*png_ptr*/, png_const_charp message)
+static void qt_png_warning(png_structp /*png_ptr*/, png_const_charp message)
{
qWarning("libpng warning: %s", message);
}
QIcon fileIcon(const QModelIndex &index) const;
QFileInfo fileInfo(const QModelIndex &index) const;
-#ifdef Q_NO_USING_KEYWORD
- inline QObject *parent() const { return QObject::parent(); }
-#else
- using QObject::parent;
-#endif
-
public Q_SLOTS:
void refresh(const QModelIndex &parent = QModelIndex());
#include <qapplication.h>
#include <qdir.h>
#include <qpixmapcache.h>
-#if defined(Q_WS_WIN)
-# define _WIN32_IE 0x0500
-# include <qt_windows.h>
-# include <commctrl.h>
-# include <objbase.h>
-#elif defined(Q_WS_MAC)
-# include <qt_cocoa_helpers_mac_p.h>
-#endif
#include <qfunctions_p.h>
#include <qguiplatformplugin_p.h>
# include <qt_x11_p.h>
#endif
-#ifndef SHGFI_ADDOVERLAYS
-# define SHGFI_ADDOVERLAYS 0x000000020
-# define SHGFI_OVERLAYINDEX 0x000000040
-#endif
-
QT_BEGIN_NAMESPACE
/*!
return QIcon();
}
-#ifdef Q_WS_WIN
-
-static bool isCacheable(const QFileInfo &fi)
-{
- if (!fi.isFile())
- return false;
-
- // On windows it's faster to just look at the file extensions. QTBUG-13182
- const QString fileExtension = fi.suffix();
- return fileExtension.compare(QLatin1String("exe"), Qt::CaseInsensitive) &&
- fileExtension.compare(QLatin1String("lnk"), Qt::CaseInsensitive) &&
- fileExtension.compare(QLatin1String("ico"), Qt::CaseInsensitive);
-}
-
-QIcon QFileIconProviderPrivate::getWinIcon(const QFileInfo &fileInfo) const
-{
- QIcon retIcon;
- static int defaultFolderIIcon = -1;
-
- QString key;
- QPixmap pixmap;
- // If it's a file, non-{exe,lnk,ico} then we might have it cached already
- if (isCacheable(fileInfo)) {
- const QString fileExtension = QLatin1Char('.') + fileInfo.suffix().toUpper();
- key = QLatin1String("qt_") + fileExtension;
- QPixmapCache::find(key, pixmap);
- if (!pixmap.isNull()) {
- retIcon.addPixmap(pixmap);
- if (QPixmapCache::find(key + QLatin1Char('l'), pixmap))
- retIcon.addPixmap(pixmap);
- return retIcon;
- }
- }
-
- const bool cacheableDirIcon = fileInfo.isDir() && !fileInfo.isRoot();
- if (!useCustomDirectoryIcons && defaultFolderIIcon >= 0 && cacheableDirIcon) {
- // We already have the default folder icon, just return it
- key = QString::fromLatin1("qt_dir_%1").arg(defaultFolderIIcon);
- QPixmapCache::find(key, pixmap);
- if (!pixmap.isNull()) {
- retIcon.addPixmap(pixmap);
- if (QPixmapCache::find(key + QLatin1Char('l'), pixmap))
- retIcon.addPixmap(pixmap);
- return retIcon;
- }
- }
-
- /* We don't use the variable, but by storing it statically, we
- * ensure CoInitialize is only called once. */
- static HRESULT comInit = CoInitialize(NULL);
- Q_UNUSED(comInit);
-
- SHFILEINFO info;
- unsigned long val = 0;
-
- //Get the small icon
- unsigned int flags =
-#ifndef Q_OS_WINCE
- SHGFI_ICON|SHGFI_SYSICONINDEX|SHGFI_ADDOVERLAYS|SHGFI_OVERLAYINDEX;
-#else
- SHGFI_SYSICONINDEX;
-#endif
-
- if (cacheableDirIcon && !useCustomDirectoryIcons) {
- flags |= SHGFI_USEFILEATTRIBUTES;
- val = SHGetFileInfo(L"dummy",
- FILE_ATTRIBUTE_DIRECTORY, &info,
- sizeof(SHFILEINFO), flags | SHGFI_SMALLICON);
- } else {
- val = SHGetFileInfo((const wchar_t *)QDir::toNativeSeparators(fileInfo.filePath()).utf16(),
- 0, &info, sizeof(SHFILEINFO), flags | SHGFI_SMALLICON);
- }
-
- // Even if GetFileInfo returns a valid result, hIcon can be empty in some cases
- if (val && info.hIcon) {
- if (fileInfo.isDir() && !fileInfo.isRoot()) {
- if (!useCustomDirectoryIcons && defaultFolderIIcon < 0)
- defaultFolderIIcon = info.iIcon;
- //using the unique icon index provided by windows save us from duplicate keys
- key = QString::fromLatin1("qt_dir_%1").arg(info.iIcon);
- QPixmapCache::find(key, pixmap);
- if (!pixmap.isNull()) {
- retIcon.addPixmap(pixmap);
- if (QPixmapCache::find(key + QLatin1Char('l'), pixmap))
- retIcon.addPixmap(pixmap);
- DestroyIcon(info.hIcon);
- return retIcon;
- }
- }
- if (pixmap.isNull()) {
-#ifndef Q_OS_WINCE
- pixmap = QPixmap::fromWinHICON(info.hIcon);
-#else
- pixmap = QPixmap::fromWinHICON(ImageList_GetIcon((HIMAGELIST) val, info.iIcon, ILD_NORMAL));
-#endif
- if (!pixmap.isNull()) {
- retIcon.addPixmap(pixmap);
- if (!key.isEmpty())
- QPixmapCache::insert(key, pixmap);
- }
- else {
- qWarning("QFileIconProviderPrivate::getWinIcon() no small icon found");
- }
- }
- DestroyIcon(info.hIcon);
- }
-
- //Get the big icon
- val = SHGetFileInfo((const wchar_t *)QDir::toNativeSeparators(fileInfo.filePath()).utf16(),
- 0, &info, sizeof(SHFILEINFO), flags | SHGFI_LARGEICON);
-
- if (val && info.hIcon) {
- if (fileInfo.isDir() && !fileInfo.isRoot()) {
- //using the unique icon index provided by windows save us from duplicate keys
- key = QString::fromLatin1("qt_dir_%1").arg(info.iIcon);
- }
-#ifndef Q_OS_WINCE
- pixmap = QPixmap::fromWinHICON(info.hIcon);
-#else
- pixmap = QPixmap::fromWinHICON(ImageList_GetIcon((HIMAGELIST) val, info.iIcon, ILD_NORMAL));
-#endif
- if (!pixmap.isNull()) {
- retIcon.addPixmap(pixmap);
- if (!key.isEmpty())
- QPixmapCache::insert(key + QLatin1Char('l'), pixmap);
- }
- else {
- qWarning("QFileIconProviderPrivate::getWinIcon() no large icon found");
- }
- DestroyIcon(info.hIcon);
- }
- return retIcon;
-}
-
-#elif defined(Q_WS_MAC)
-QIcon QFileIconProviderPrivate::getMacIcon(const QFileInfo &fi) const
-{
- QIcon retIcon;
- QString fileExtension = fi.suffix().toUpper();
- fileExtension.prepend(QLatin1String("."));
-
- const QString keyBase = QLatin1String("qt_") + fileExtension;
-
- QPixmap pixmap;
- if (fi.isFile() && !fi.isExecutable() && !fi.isSymLink()) {
- QPixmapCache::find(keyBase + QLatin1String("16"), pixmap);
- }
-
- if (!pixmap.isNull()) {
- retIcon.addPixmap(pixmap);
- if (QPixmapCache::find(keyBase + QLatin1String("32"), pixmap)) {
- retIcon.addPixmap(pixmap);
- if (QPixmapCache::find(keyBase + QLatin1String("64"), pixmap)) {
- retIcon.addPixmap(pixmap);
- if (QPixmapCache::find(keyBase + QLatin1String("128"), pixmap)) {
- retIcon.addPixmap(pixmap);
- return retIcon;
- }
- }
- }
- }
-
-
- FSRef macRef;
- OSStatus status = FSPathMakeRef(reinterpret_cast<const UInt8*>(fi.canonicalFilePath().toUtf8().constData()),
- &macRef, 0);
- if (status != noErr)
- return retIcon;
- FSCatalogInfo info;
- HFSUniStr255 macName;
- status = FSGetCatalogInfo(&macRef, kIconServicesCatalogInfoMask, &info, &macName, 0, 0);
- if (status != noErr)
- return retIcon;
- IconRef iconRef;
- SInt16 iconLabel;
- status = GetIconRefFromFileInfo(&macRef, macName.length, macName.unicode,
- kIconServicesCatalogInfoMask, &info, kIconServicesNormalUsageFlag,
- &iconRef, &iconLabel);
- if (status != noErr)
- return retIcon;
- qt_mac_constructQIconFromIconRef(iconRef, 0, &retIcon);
- ReleaseIconRef(iconRef);
-
- if (fi.isFile() && !fi.isExecutable() && !fi.isSymLink()) {
- pixmap = retIcon.pixmap(16);
- QPixmapCache::insert(keyBase + QLatin1String("16"), pixmap);
- pixmap = retIcon.pixmap(32);
- QPixmapCache::insert(keyBase + QLatin1String("32"), pixmap);
- pixmap = retIcon.pixmap(64);
- QPixmapCache::insert(keyBase + QLatin1String("64"), pixmap);
- pixmap = retIcon.pixmap(128);
- QPixmapCache::insert(keyBase + QLatin1String("128"), pixmap);
- }
-
- return retIcon;
-}
-#endif
-
-
/*!
Returns an icon for the file described by \a info.
*/
}
#endif
-#ifdef Q_WS_MAC
- QIcon retIcon = d->getMacIcon(info);
- if (!retIcon.isNull())
- return retIcon;
-#elif defined Q_WS_WIN
- QIcon icon = d->getWinIcon(info);
- if (!icon.isNull())
- return icon;
-#endif
if (info.isRoot())
-#if defined (Q_WS_WIN) && !defined(Q_WS_WINCE)
- {
- UINT type = GetDriveType((wchar_t *)info.absoluteFilePath().utf16());
-
- switch (type) {
- case DRIVE_REMOVABLE:
- return d->getIcon(QStyle::SP_DriveFDIcon);
- case DRIVE_FIXED:
- return d->getIcon(QStyle::SP_DriveHDIcon);
- case DRIVE_REMOTE:
- return d->getIcon(QStyle::SP_DriveNetIcon);
- case DRIVE_CDROM:
- return d->getIcon(QStyle::SP_DriveCDIcon);
- case DRIVE_RAMDISK:
- case DRIVE_UNKNOWN:
- case DRIVE_NO_ROOT_DIR:
- default:
- return d->getIcon(QStyle::SP_DriveHDIcon);
- }
- }
-#else
- return d->getIcon(QStyle::SP_DriveHDIcon);
-#endif
+ return d->getIcon(QStyle::SP_DriveHDIcon);
if (info.isFile()) {
if (info.isSymLink())
return d->getIcon(QStyle::SP_FileLinkIcon);
}
if (info.isDir())
-#ifdef Q_WS_WIN
- return QApplication::translate("QFileDialog", "File Folder", "Match Windows Explorer");
-#else
return QApplication::translate("QFileDialog", "Folder", "All other platforms");
-#endif
- // Windows - "File Folder"
- // OS X - "Folder"
// Konqueror - "Folder"
// Nautilus - "folder"
if (info.isSymLink())
-#ifdef Q_OS_MAC
- return QApplication::translate("QFileDialog", "Alias", "Mac OS X Finder");
-#else
return QApplication::translate("QFileDialog", "Shortcut", "All other platforms");
-#endif
- // OS X - "Alias"
- // Windows - "Shortcut"
// Konqueror - "Folder" or "TXT File" i.e. what it is pointing to
// Nautilus - "link to folder" or "link to object file", same as Konqueror
if (customize)
; // don't modify window flags if the user explicitly set them.
else if (type == Qt::Dialog || type == Qt::Sheet)
-#ifndef Q_WS_WINCE
flags |= Qt::WindowTitleHint | Qt::WindowSystemMenuHint | Qt::WindowContextHelpButtonHint | Qt::WindowCloseButtonHint;
-#else
- flags |= Qt::WindowTitleHint | Qt::WindowSystemMenuHint | Qt::WindowCloseButtonHint;
-#endif
else if (type == Qt::Tool)
flags |= Qt::WindowTitleHint | Qt::WindowSystemMenuHint | Qt::WindowCloseButtonHint;
else
{
if (!isEnabled()) {
data->pal.setCurrentColorGroup(QPalette::Disabled);
- } else if ((!isVisible() || isActiveWindow())
-#if defined(Q_OS_WIN) && !defined(Q_WS_WINCE)
- && !QApplicationPrivate::isBlockedByModal(const_cast<QWidget *>(this))
-#endif
- ) {
+ } else if (!isVisible() || isActiveWindow()) {
data->pal.setCurrentColorGroup(QPalette::Active);
} else {
-#ifdef Q_WS_MAC
- extern bool qt_mac_can_clickThrough(const QWidget *); //qwidget_mac.cpp
- if (qt_mac_can_clickThrough(this))
- data->pal.setCurrentColorGroup(QPalette::Active);
- else
-#endif
- data->pal.setCurrentColorGroup(QPalette::Inactive);
+ data->pal.setCurrentColorGroup(QPalette::Inactive);
}
return data->pal;
}
if (exp & Qt::Vertical)
s.setHeight(qMax(s.height(), 100));
#if defined(Q_WS_X11)
- QRect screen = QApplication::desktop()->screenGeometry(q->x11Info().screen());
+ const QRect screen = QApplication::desktop()->screenGeometry(q->x11Info().screen());
#else // all others
- QRect screen = QApplication::desktop()->screenGeometry(q->pos());
+ const QRect screen = QApplication::desktop()->screenGeometry(q->pos());
#endif
-#if defined (Q_WS_WINCE)
- s.setWidth(qMin(s.width(), screen.width()));
- s.setHeight(qMin(s.height(), screen.height()));
-#else
s.setWidth(qMin(s.width(), screen.width()*2/3));
s.setHeight(qMin(s.height(), screen.height()*2/3));
-#endif
if (QTLWExtra *extra = maybeTopData())
extra->sizeAdjusted = true;
}
virtual void setVisible(bool visible);
inline void setHidden(bool hidden) { setVisible(!hidden); }
-#ifndef Q_WS_WINCE
inline void show() { setVisible(true); }
-#else
- void show();
-#endif
inline void hide() { setVisible(false); }
void showMinimized();
#include <qlabel.h>
#include <qbitmap.h>
#include <qmath.h>
-
#include <qfontengine_ft_p.h>
#include <qmath_p.h>
#include <qtextengine_p.h>
#include <qimage_p.h>
#include <qstatictext_p.h>
#include "qmemrotate_p.h"
-
#include "qpaintengine_raster_p.h"
#include "qoutlinemapper_p.h"
-#if defined(Q_WS_WIN)
-# include <qt_windows.h>
-# include <qvarlengtharray.h>
-# include <qfontengine_p.h>
-# if defined(Q_OS_WINCE)
-# include "qguifunctions_wince.h"
-# endif
-#elif defined(Q_WS_MAC)
-# include <qt_mac_p.h>
-# include <qpaintengine_mac_p.h>
-#endif
-
-#if defined(Q_WS_WIN64)
-# include <malloc.h>
-#endif
#include <limits.h>
QT_BEGIN_NAMESPACE
// use the same rounding as in qrasterizer.cpp (6 bit fixed point)
static const qreal aliasedCoordinateDelta = 0.5 - 0.015625;
-#ifdef Q_WS_WIN
-extern bool qt_cleartype_enabled;
-#endif
-
-#ifdef Q_WS_MAC
-extern bool qt_applefontsmoothing_enabled;
-#endif
-
/********************************************************************************
* Span functions
{
Q_D(QRasterPaintEngine);
-
-#ifdef Q_WS_WIN
- d->hdc = 0;
-#endif
-
d->rasterizer.reset(new QRasterizer);
d->rasterBuffer.reset(new QRasterBuffer());
d->outlineMapper.reset(new QOutlineMapper);
}
#endif
-#if defined(Q_WS_WIN)
- d->isPlain45DegreeRotation = true;
-#endif
-
if (d->mono_surface)
d->glyphCacheType = QFontEngineGlyphCache::Raster_Mono;
-#if defined(Q_WS_WIN)
- else if (qt_cleartype_enabled)
-#elif defined (Q_WS_MAC)
- else if (qt_applefontsmoothing_enabled)
-#else
- else if (false)
-#endif
- {
- QImage::Format format = static_cast<QImage *>(d->device)->format();
- if (format == QImage::Format_ARGB32_Premultiplied || format == QImage::Format_RGB32)
- d->glyphCacheType = QFontEngineGlyphCache::Raster_RGBMask;
- else
- d->glyphCacheType = QFontEngineGlyphCache::Raster_A8;
- } else
- d->glyphCacheType = QFontEngineGlyphCache::Raster_A8;
+ d->glyphCacheType = QFontEngineGlyphCache::Raster_A8;
setActive(true);
return true;
s->flags.tx_noshear = qt_scaleForTransform(s->matrix, &s->txscale);
ensureOutlineMapper();
-
-#ifdef Q_WS_WIN
- Q_D(QRasterPaintEngine);
- d->isPlain45DegreeRotation = false;
- if (txop >= QTransform::TxRotate) {
- d->isPlain45DegreeRotation =
- (qFuzzyIsNull(matrix.m11())
- && qFuzzyIsNull(matrix.m12() - qreal(1))
- && qFuzzyIsNull(matrix.m21() + qreal(1))
- && qFuzzyIsNull(matrix.m22())
- )
- ||
- (qFuzzyIsNull(matrix.m11() + qreal(1))
- && qFuzzyIsNull(matrix.m12())
- && qFuzzyIsNull(matrix.m21())
- && qFuzzyIsNull(matrix.m22() + qreal(1))
- )
- ||
- (qFuzzyIsNull(matrix.m11())
- && qFuzzyIsNull(matrix.m12() + qreal(1))
- && qFuzzyIsNull(matrix.m21() - qreal(1))
- && qFuzzyIsNull(matrix.m22())
- )
- ;
- }
-#endif
}
ensurePen();
ensureRasterState();
-#if defined (Q_WS_WIN) || defined(Q_WS_MAC)
-
- if (!supportsTransformations(ti.fontEngine)) {
- QVarLengthArray<QFixedPoint> positions;
- QVarLengthArray<glyph_t> glyphs;
-
- QTransform matrix = s->matrix;
- matrix.translate(p.x(), p.y());
-
- ti.fontEngine->getGlyphPositions(ti.glyphs, matrix, ti.flags, glyphs, positions);
-
- drawCachedGlyphs(glyphs.size(), glyphs.constData(), positions.constData(), ti.fontEngine);
- return;
- }
-
-#else // Q_WS_WIN || Q_WS_MAC
-
QFontEngine *fontEngine = ti.fontEngine;
#if defined(Q_WS_X11) && !defined(QT_NO_FREETYPE)
return;
#endif
-#endif
QPaintEngineEx::drawTextItem(p, ti);
}
QPaintEngineEx::drawEllipse(rect);
}
-/*!
- \internal
-*/
-#ifdef Q_WS_MAC
-void QRasterPaintEngine::setCGContext(CGContextRef ctx)
-{
- Q_D(QRasterPaintEngine);
- d->cgContext = ctx;
-}
-
-/*!
- \internal
-*/
-CGContextRef QRasterPaintEngine::getCGContext() const
-{
- Q_D(const QRasterPaintEngine);
- return d->cgContext;
-}
-#endif
-
-#ifdef Q_WS_WIN
-/*!
- \internal
-*/
-void QRasterPaintEngine::setDC(HDC hdc) {
- Q_D(QRasterPaintEngine);
- d->hdc = hdc;
-}
-
-/*!
- \internal
-*/
-HDC QRasterPaintEngine::getDC() const
-{
- Q_D(const QRasterPaintEngine);
- return d->hdc;
-}
-
-/*!
- \internal
-*/
-void QRasterPaintEngine::releaseDC(HDC) const
-{
-}
-
-#endif
-
bool QRasterPaintEngine::supportsTransformations(const QFontEngine *fontEngine) const
{
if (!state()->WxF)
return false;
}
-/*!
- \internal
-*/
-QPoint QRasterPaintEngine::coordinateOffset() const
-{
- return QPoint(0, 0);
-}
-
void QRasterPaintEngine::drawBitmap(const QPointF &pos, const QImage &image, QSpanData *fg)
{
Q_ASSERT(fg);
#ifdef Q_NO_USING_KEYWORD
inline void drawEllipse(const QRect &rect) { QPaintEngineEx::drawEllipse(rect); }
#else
- using QPaintEngineEx::drawPolygon;
using QPaintEngineEx::drawEllipse;
#endif
Type type() const { return Raster; }
- QPoint coordinateOffset() const;
-
bool supportsTransformations(const QFontEngine *fontEngine) const;
bool supportsTransformations(qreal pixelSize, const QTransform &m) const;
return QLineF(0, 0, m1, m2).angle();
}
-#if defined(Q_WS_WINCE)
-#pragma warning( disable : 4056 4756 )
-#endif
-
/*!
Returns the slope of the path at the percentage \a t. The
argument \a t has to be between 0 and 1.
void addRequiredBoundaries() const;
void shapeText(int item) const;
void shapeTextWithHarfbuzz(int item) const;
-#if defined(Q_WS_WINCE)
- void shapeTextWithCE(int item) const;
-#endif
-#if defined(Q_WS_MAC)
- void shapeTextMac(int item) const;
-#endif
void splitItem(int item, int pos) const;
void resolveAdditionalFormats() const;
QAlphaWidget::~QAlphaWidget()
{
-#if defined(Q_WS_WIN) && !defined(Q_WS_WINCE)
- // Restore user-defined opacity value
- if (widget)
- widget->setWindowOpacity(1);
-#endif
}
/*
checkTime.start();
showWidget = true;
-#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
- qApp->installEventFilter(this);
- widget->setWindowOpacity(0.0);
- widget->show();
- connect(&anim, SIGNAL(timeout()), this, SLOT(render()));
- anim.start(1);
-#else
//This is roughly equivalent to calling setVisible(true) without actually showing the widget
widget->setAttribute(Qt::WA_WState_ExplicitShowHide, true);
widget->setAttribute(Qt::WA_WState_Hidden, false);
duration = 0;
render();
}
-#endif
}
/*
else
alpha = 1;
-#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
- if (alpha >= 1 || !showWidget) {
- anim.stop();
- qApp->removeEventFilter(this);
- widget->setWindowOpacity(1);
- q_blend = 0;
- deleteLater();
- } else {
- widget->setWindowOpacity(alpha);
- }
-#else
if (alpha >= 1 || !showWidget) {
anim.stop();
qApp->removeEventFilter(this);
if (widget) {
if (!showWidget) {
-#ifdef Q_WS_WIN
- setEnabled(true);
- setFocus();
-#endif // Q_WS_WIN
widget->hide();
} else {
//Since we are faking the visibility of the widget
pm = QPixmap::fromImage(mixedImage);
repaint();
}
-#endif // defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
}
/*
d->widgetItems.remove(e->action());
}
-#ifdef Q_WS_MAC
- if (d->mac_menu) {
- if (e->type() == QEvent::ActionAdded)
- d->mac_menu->addAction(e->action(), d->mac_menu->findAction(e->before()), d);
- else if (e->type() == QEvent::ActionRemoved)
- d->mac_menu->removeAction(e->action());
- else if (e->type() == QEvent::ActionChanged)
- d->mac_menu->syncAction(e->action());
- }
-#endif
-
-#if defined(Q_WS_WINCE) && !defined(QT_NO_MENUBAR)
- if (!d->wce_menu)
- d->wce_menu = new QMenuPrivate::QWceMenuPrivate;
- if (e->type() == QEvent::ActionAdded)
- d->wce_menu->addAction(e->action(), d->wce_menu->findAction(e->before()));
- else if (e->type() == QEvent::ActionRemoved)
- d->wce_menu->removeAction(e->action());
- else if (e->type() == QEvent::ActionChanged)
- d->wce_menu->syncAction(e->action());
-#endif
-
if (isVisible()) {
d->updateActionRects();
resize(sizeHint());
#include <QtGui/qicon.h>
#include <QtGui/qaction.h>
-
-#ifdef Q_WS_WINCE
-#include <windef.h> // for HMENU
-#endif
-
QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
void setIcon(const QIcon &icon);
void setNoReplayFor(QWidget *widget);
-#ifdef Q_WS_MAC
- OSMenuRef macMenu(OSMenuRef merge=0);
-#endif
-
-#ifdef Q_WS_WINCE
- HMENU wceMenu();
-#endif
bool separatorsCollapsible() const;
void setSeparatorsCollapsible(bool collapse);
bool focusNextPrevChild(bool next);
void initStyleOption(QStyleOptionMenuItem *option, const QAction *action) const;
-#ifdef Q_WS_WINCE
- QAction* wceCommands(uint command);
-#endif
-
private Q_SLOTS:
void internalSetSloppyAction();
void internalDelayedPopup();
friend class QComboBox;
friend class QAction;
friend class QToolButtonPrivate;
-
-#ifdef Q_WS_MAC
- friend void qt_mac_trayicon_activate_action(QMenu *, QAction *action);
- friend bool qt_mac_watchingAboutToShow(QMenu *);
- friend OSStatus qt_mac_menu_event(EventHandlerCallRef, EventRef, void *);
- friend bool qt_mac_activate_action(OSMenuRef, uint, QAction::ActionEvent, bool);
- friend void qt_mac_emit_menuSignals(QMenu *, bool);
- friend void qt_mac_menu_emit_hovered(QMenu *menu, QAction *action);
-#endif
};
#endif // QT_NO_MENU
class QTornOffMenu;
class QEventLoop;
-#ifdef Q_WS_MAC
-# ifdef __OBJC__
-QT_END_NAMESPACE
-@class NSMenuItem;
-QT_BEGIN_NAMESPACE
-# else
-typedef void NSMenuItem;
-# endif //__OBJC__
-struct QMacMenuAction {
- QMacMenuAction()
-#ifndef QT_MAC_USE_COCOA
- : command(0)
-#else
- : menuItem(0)
-#endif
- , ignore_accel(0), merged(0), menu(0)
- {
- }
- ~QMacMenuAction();
-#ifndef QT_MAC_USE_COCOA
- uint command;
-#else
- NSMenuItem *menuItem;
-#endif
- uchar ignore_accel : 1;
- uchar merged : 1;
- QPointer<QAction> action;
- OSMenuRef menu;
-};
-
-struct QMenuMergeItem
-{
-#ifndef QT_MAC_USE_COCOA
- inline QMenuMergeItem(MenuCommand c, QMacMenuAction *a) : command(c), action(a) { }
- MenuCommand command;
-#else
- inline QMenuMergeItem(NSMenuItem *c, QMacMenuAction *a) : menuItem(c), action(a) { }
- NSMenuItem *menuItem;
-#endif
- QMacMenuAction *action;
-};
-typedef QList<QMenuMergeItem> QMenuMergeList;
-#endif
-
-#ifdef Q_WS_WINCE
-struct QWceMenuAction {
- uint command;
- QPointer<QAction> action;
- HMENU menuHandle;
- QWceMenuAction() : menuHandle(0), command(0) {}
-};
-#endif
-
class QMenuPrivate : public QWidgetPrivate
{
Q_DECLARE_PUBLIC(QMenu)
#endif
scroll(0), eventLoop(0), tearoff(0), tornoff(0), tearoffHighlighted(0),
hasCheckableItems(0), sloppyDelayTimer(0), sloppyAction(0), doChildEffects(false)
-#ifdef Q_WS_MAC
- ,mac_menu(0)
-#endif
-#if defined(Q_WS_WINCE) && !defined(QT_NO_MENUBAR)
- ,wce_menu(0)
-#endif
{ }
~QMenuPrivate()
{
delete scroll;
-#ifdef Q_WS_MAC
- delete mac_menu;
-#endif
-#if defined(Q_WS_WINCE) && !defined(QT_NO_MENUBAR)
- delete wce_menu;
-#endif
}
void init();
//menu fading/scrolling effects
bool doChildEffects;
-#ifdef Q_WS_MAC
- //mac menu binding
- struct QMacMenuPrivate {
- QList<QMacMenuAction*> actionItems;
- OSMenuRef menu;
- QMacMenuPrivate();
- ~QMacMenuPrivate();
-
- bool merged(const QAction *action) const;
- void addAction(QAction *, QMacMenuAction* =0, QMenuPrivate *qmenu = 0);
- void addAction(QMacMenuAction *, QMacMenuAction* =0, QMenuPrivate *qmenu = 0);
- void syncAction(QMacMenuAction *);
- inline void syncAction(QAction *a) { syncAction(findAction(a)); }
- void removeAction(QMacMenuAction *);
- inline void removeAction(QAction *a) { removeAction(findAction(a)); }
- inline QMacMenuAction *findAction(QAction *a) {
- for(int i = 0; i < actionItems.size(); i++) {
- QMacMenuAction *act = actionItems[i];
- if(a == act->action)
- return act;
- }
- return 0;
- }
- } *mac_menu;
- OSMenuRef macMenu(OSMenuRef merge);
-#ifndef QT_MAC_USE_COCOA
- void setMacMenuEnabled(bool enable = true);
-#endif
- void syncSeparatorsCollapsible(bool collapsible);
- static QHash<OSMenuRef, OSMenuRef> mergeMenuHash;
- static QHash<OSMenuRef, QMenuMergeList*> mergeMenuItemsHash;
-#endif
-
QPointer<QAction> actionAboutToTrigger;
-#if defined(Q_WS_WINCE) && !defined(QT_NO_MENUBAR)
- struct QWceMenuPrivate {
- QList<QWceMenuAction*> actionItems;
- HMENU menuHandle;
- QWceMenuPrivate();
- ~QWceMenuPrivate();
- void addAction(QAction *, QWceMenuAction* =0);
- void addAction(QWceMenuAction *, QWceMenuAction* =0);
- void syncAction(QWceMenuAction *);
- inline void syncAction(QAction *a) { syncAction(findAction(a)); }
- void removeAction(QWceMenuAction *);
- void rebuild();
- inline void removeAction(QAction *a) { removeAction(findAction(a)); }
- inline QWceMenuAction *findAction(QAction *a) {
- for(int i = 0; i < actionItems.size(); i++) {
- QWceMenuAction *act = actionItems[i];
- if(a == act->action)
- return act;
- }
- return 0;
- }
- } *wce_menu;
- HMENU wceMenu();
- QAction* wceCommands(uint command);
-#endif
QPointer<QWidget> noReplayFor;
};
#include "qmenubar_x11_p.h"
#endif
-#ifdef Q_WS_WINCE
-extern bool qt_wince_is_mobile(); //defined in qguifunctions_wce.cpp
-#endif
-
QT_BEGIN_NAMESPACE
class QMenuBarExtension : public QToolButton
}
}
-#ifdef Q_WS_MAC
- if(q->isNativeMenuBar()) {//nothing to see here folks, move along..
- itemsDirty = false;
- return;
- }
-#endif
calcActionRects(q_width, q_start);
currentAction = 0;
#ifndef QT_NO_SHORTCUT
Q_Q(QMenuBar);
q->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Minimum);
q->setAttribute(Qt::WA_CustomWhatsThis);
-#ifdef Q_WS_MAC
- macCreateMenuBar(q->parentWidget());
- if(mac_menubar)
- q->hide();
-#endif
-#ifdef Q_WS_WINCE
- if (qt_wince_is_mobile()) {
- wceCreateMenuBar(q->parentWidget());
- if(wce_menubar)
- q->hide();
- }
- else {
- QApplication::setAttribute(Qt::AA_DontUseNativeMenuBar, true);
- }
-#endif
#ifdef Q_WS_X11
platformMenuBar = qt_guiPlatformMenuBarFactory()->create();
platformMenuBar->init(q);
*/
QMenuBar::~QMenuBar()
{
-#ifdef Q_WS_MAC
- Q_D(QMenuBar);
- d->macDestroyMenuBar();
-#endif
-#ifdef Q_WS_WINCE
- Q_D(QMenuBar);
- if (qt_wince_is_mobile())
- d->wceDestroyMenuBar();
-#endif
#ifdef Q_WS_X11
Q_D(QMenuBar);
delete d->cornerWidgetToolBar;
Q_D(QMenuBar);
d->platformMenuBar->setVisible(visible);
#else
-#if defined(Q_WS_MAC) || defined(Q_OS_WINCE) || defined(Q_WS_S60)
- if (isNativeMenuBar()) {
- if (!visible)
- QWidget::setVisible(false);
- return;
- }
-#endif
QWidget::setVisible(visible);
#endif // Q_WS_X11
}
#ifdef Q_WS_X11
d->platformMenuBar->actionEvent(e);
#endif
-#if defined (Q_WS_MAC) || defined(Q_OS_WINCE) || defined(Q_WS_S60)
- if (isNativeMenuBar()) {
-#ifdef Q_WS_MAC
- QMenuBarPrivate::QMacMenuBarPrivate *nativeMenuBar = d->mac_menubar;
-#else
- QMenuBarPrivate::QWceMenuBarPrivate *nativeMenuBar = d->wce_menubar;
-#endif
- if (!nativeMenuBar)
- return;
- if(e->type() == QEvent::ActionAdded)
- nativeMenuBar->addAction(e->action(), e->before());
- else if(e->type() == QEvent::ActionRemoved)
- nativeMenuBar->removeAction(e->action());
- else if(e->type() == QEvent::ActionChanged)
- nativeMenuBar->syncAction(e->action());
- }
-#endif
if(e->type() == QEvent::ActionAdded) {
connect(e->action(), SIGNAL(triggered()), this, SLOT(_q_actionTriggered()));
oldParent = newParent;
oldWindow = newWindow;
-
-#ifdef Q_WS_MAC
- if (q->isNativeMenuBar() && !macWidgetHasNativeMenubar(newParent)) {
- // If the new parent got a native menubar from before, keep that
- // menubar rather than replace it with this one (because a parents
- // menubar has precedence over children menubars).
- macDestroyMenuBar();
- macCreateMenuBar(newParent);
- }
-#endif
-
-#ifdef Q_WS_WINCE
- if (qt_wince_is_mobile() && wce_menubar)
- wce_menubar->rebuild();
-#endif
}
QSize QMenuBar::minimumSizeHint() const
{
Q_D(const QMenuBar);
-#if defined(Q_WS_MAC) || defined(Q_WS_WINCE) || defined(Q_WS_S60) || defined(Q_WS_X11)
+#if defined(Q_WS_X11)
const bool as_gui_menubar = !isNativeMenuBar();
#else
const bool as_gui_menubar = true;
QSize QMenuBar::sizeHint() const
{
Q_D(const QMenuBar);
-#if defined(Q_WS_MAC) || defined(Q_WS_WINCE) || defined(Q_WS_S60) || defined(Q_WS_X11)
+#if defined(Q_WS_X11)
const bool as_gui_menubar = !isNativeMenuBar();
#else
const bool as_gui_menubar = true;
int QMenuBar::heightForWidth(int) const
{
Q_D(const QMenuBar);
-#if defined(Q_WS_MAC) || defined(Q_WS_WINCE) || defined(Q_WS_S60) || defined(Q_WS_X11)
+#if defined(Q_WS_X11)
const bool as_gui_menubar = !isNativeMenuBar();
#else
const bool as_gui_menubar = true;
#else
if (d->nativeMenuBar == -1 || (nativeMenuBar != bool(d->nativeMenuBar))) {
d->nativeMenuBar = nativeMenuBar;
-#ifdef Q_WS_MAC
- if (!d->nativeMenuBar) {
- extern void qt_mac_clear_menubar();
- qt_mac_clear_menubar();
- d->macDestroyMenuBar();
- const QList<QAction *> &menubarActions = actions();
- for (int i = 0; i < menubarActions.size(); ++i) {
- const QAction *action = menubarActions.at(i);
- if (QMenu *menu = action->menu()) {
- delete menu->d_func()->mac_menu;
- menu->d_func()->mac_menu = 0;
- }
- }
- } else {
- d->macCreateMenuBar(parentWidget());
- }
- macUpdateMenuBar();
- updateGeometry();
- if (!d->nativeMenuBar && parentWidget())
- setVisible(true);
-#endif
}
#endif // Q_WS_X11
}
}
/*!
- \since 4.4
-
- Sets the default action to \a act.
-
- The default action is assigned to the left soft key. The menu is assigned
- to the right soft key.
-
- Currently there is only support for the default action on Windows
- Mobile. On all other platforms this method is not available.
-
- \sa defaultAction()
-*/
-
-#ifdef Q_WS_WINCE
-void QMenuBar::setDefaultAction(QAction *act)
-{
- Q_D(QMenuBar);
- if (d->defaultAction == act)
- return;
-#ifdef Q_WS_WINCE
- if (qt_wince_is_mobile())
- if (d->defaultAction) {
- disconnect(d->defaultAction, SIGNAL(changed()), this, SLOT(_q_updateDefaultAction()));
- disconnect(d->defaultAction, SIGNAL(destroyed()), this, SLOT(_q_updateDefaultAction()));
- }
-#endif
- d->defaultAction = act;
-#ifdef Q_WS_WINCE
- if (qt_wince_is_mobile())
- if (d->defaultAction) {
- connect(d->defaultAction, SIGNAL(changed()), this, SLOT(_q_updateDefaultAction()));
- connect(d->defaultAction, SIGNAL(destroyed()), this, SLOT(_q_updateDefaultAction()));
- }
- if (d->wce_menubar) {
- d->wce_menubar->rebuild();
- }
-#endif
-}
-
-/*!
- \since 4.4
-
- Returns the current default action.
-
- \sa setDefaultAction()
-*/
-QAction *QMenuBar::defaultAction() const
-{
- return d_func()->defaultAction;
-}
-#endif
-
-/*!
\fn void QMenuBar::triggered(QAction *action)
This signal is emitted when an action in a menu belonging to this menubar
void setCornerWidget(QWidget *w, Qt::Corner corner = Qt::TopRightCorner);
QWidget *cornerWidget(Qt::Corner corner = Qt::TopRightCorner) const;
-#ifdef Q_WS_MAC
- OSMenuRef macMenu();
- static bool macUpdateMenuBar();
-#endif
-
-#ifdef Q_WS_WINCE
- void setDefaultAction(QAction *);
- QAction *defaultAction() const;
-
- static void wceCommands(uint command);
- static void wceRefresh();
-#endif
-
bool isNativeMenuBar() const;
void setNativeMenuBar(bool nativeMenuBar);
Q_PRIVATE_SLOT(d_func(), void _q_internalShortcutActivated(int))
Q_PRIVATE_SLOT(d_func(), void _q_updateLayout())
-#ifdef Q_WS_WINCE
- Q_PRIVATE_SLOT(d_func(), void _q_updateDefaultAction())
-#endif
-
friend class QMenu;
friend class QMenuPrivate;
friend class QWindowsStyle;
-
-#ifdef Q_WS_MAC
- friend class QApplicationPrivate;
- friend class QWidgetPrivate;
- friend bool qt_mac_activate_action(MenuRef, uint, QAction::ActionEvent, bool);
-#endif
};
#endif // QT_NO_MENUBAR
// We mean it.
//
-#ifndef QMAC_Q3MENUBAR_CPP_FILE
#include "QtGui/qstyleoption.h"
-#include <qmenu_p.h> // Mac needs what in this file!
-
-#ifdef Q_WS_WINCE
-#include "qguifunctions_wince.h"
-#endif
+#include "qwidget_p.h"
+#include "qbasictimer.h"
#ifdef Q_WS_X11
#include "qabstractplatformmenubar_p.h"
#endif
-#ifndef QT_NO_MENUBAR
-#endif
-
QT_BEGIN_NAMESPACE
#ifndef QT_NO_MENUBAR
, nativeMenuBar(-1)
#endif
, doChildEffects(false)
-#ifdef Q_WS_MAC
- , mac_menubar(0)
-#endif
#ifdef Q_WS_X11
, platformMenuBar(0)
#endif
-#ifdef Q_WS_WINCE
- , wce_menubar(0), wceClassicMenu(false)
-#endif
{ }
~QMenuBarPrivate()
#ifdef Q_WS_X11
delete platformMenuBar;
#endif
-#ifdef Q_WS_MAC
- delete mac_menubar;
-#endif
-#ifdef Q_WS_WINCE
- delete wce_menubar;
-#endif
}
void init();
void _q_internalShortcutActivated(int);
void _q_updateLayout();
-#ifdef Q_WS_WINCE
- void _q_updateDefaultAction();
-#endif
-
//extra widgets in the menubar
QPointer<QWidget> leftWidget, rightWidget;
QMenuBarExtension *extension;
#ifdef Q_WS_X11
QAbstractPlatformMenuBar *platformMenuBar;
#endif
-#ifdef Q_WS_MAC
- //mac menubar binding
- struct QMacMenuBarPrivate {
- QList<QMacMenuAction*> actionItems;
- OSMenuRef menu, apple_menu;
- QMacMenuBarPrivate();
- ~QMacMenuBarPrivate();
-
- void addAction(QAction *, QAction* =0);
- void addAction(QMacMenuAction *, QMacMenuAction* =0);
- void syncAction(QMacMenuAction *);
- inline void syncAction(QAction *a) { syncAction(findAction(a)); }
- void removeAction(QMacMenuAction *);
- inline void removeAction(QAction *a) { removeAction(findAction(a)); }
- inline QMacMenuAction *findAction(QAction *a) {
- for(int i = 0; i < actionItems.size(); i++) {
- QMacMenuAction *act = actionItems[i];
- if(a == act->action)
- return act;
- }
- return 0;
- }
- } *mac_menubar;
- static bool macUpdateMenuBarImmediatly();
- bool macWidgetHasNativeMenubar(QWidget *widget);
- void macCreateMenuBar(QWidget *);
- void macDestroyMenuBar();
- OSMenuRef macMenu();
-#endif
-#ifdef Q_WS_WINCE
- void wceCreateMenuBar(QWidget *);
- void wceDestroyMenuBar();
- struct QWceMenuBarPrivate {
- QList<QWceMenuAction*> actionItems;
- QList<QWceMenuAction*> actionItemsLeftButton;
- QList<QList<QWceMenuAction*>> actionItemsClassic;
- HMENU menuHandle;
- HMENU leftButtonMenuHandle;
- HWND menubarHandle;
- HWND parentWindowHandle;
- bool leftButtonIsMenu;
- QPointer<QAction> leftButtonAction;
- QMenuBarPrivate *d;
- int leftButtonCommand;
-
- QWceMenuBarPrivate(QMenuBarPrivate *menubar);
- ~QWceMenuBarPrivate();
- void addAction(QAction *, QAction* =0);
- void addAction(QWceMenuAction *, QWceMenuAction* =0);
- void syncAction(QWceMenuAction *);
- inline void syncAction(QAction *a) { syncAction(findAction(a)); }
- void removeAction(QWceMenuAction *);
- void rebuild();
- inline void removeAction(QAction *a) { removeAction(findAction(a)); }
- inline QWceMenuAction *findAction(QAction *a) {
- for(int i = 0; i < actionItems.size(); i++) {
- QWceMenuAction *act = actionItems[i];
- if(a == act->action)
- return act;
- }
- return 0;
- }
- } *wce_menubar;
- bool wceClassicMenu;
- void wceCommands(uint command);
- void wceRefresh();
- bool wceEmitSignals(QList<QWceMenuAction*> actions, uint command);
-#endif
#ifdef Q_WS_X11
void updateCornerWidgetToolBar();
QWidget *cornerWidgetContainer;
#endif
};
-#endif
#endif // QT_NO_MENUBAR
#include <qwidgetaction.h>
#include <qtimer.h>
#include <qwidgetaction_p.h>
-#ifdef Q_WS_MAC
-#include <qt_mac_p.h>
-#include <qt_cocoa_helpers_mac_p.h>
-#endif
-
#include <qmainwindowlayout_p.h>
#include "qtoolbar_p.h"
QT_BEGIN_NAMESPACE
-#ifdef Q_WS_MAC
-static void qt_mac_updateToolBarButtonHint(QWidget *parentWidget)
-{
- if (!(parentWidget->windowFlags() & Qt::CustomizeWindowHint))
- parentWidget->setWindowFlags(parentWidget->windowFlags() | Qt::MacWindowToolBarButtonHint);
-}
-#endif
-
// qmainwindow.cpp
extern QMainWindowLayout *qt_mainwindow_layout(const QMainWindow *window);
layout = new QToolBarLayout(q);
layout->updateMarginAndSpacing();
-#ifdef Q_WS_MAC
- if (q->parentWidget() && q->parentWidget()->isWindow()) {
- // Make sure that the window has the "toolbar" button.
- QWidget *parentWidget = q->parentWidget();
- qt_mac_updateToolBarButtonHint(parentWidget);
- reinterpret_cast<QToolBar *>(parentWidget)->d_func()->createWinId(); // Please let me create your winId...
- extern OSWindowRef qt_mac_window_for(const QWidget *); // qwidget_mac.cpp
- macWindowToolbarShow(q->parentWidget(), true);
- }
-#endif
-
toggleViewAction = new QAction(q);
toggleViewAction->setCheckable(true);
q->setMovable(q->style()->styleHint(QStyle::SH_ToolBar_Movable, 0, q ));
if (unplug) {
flags |= Qt::X11BypassWindowManagerHint;
-#ifdef Q_WS_MAC
- flags |= Qt::WindowStaysOnTopHint;
-#endif
}
q->setWindowFlags(flags);
if (!moving) {
state->widgetItem = layout->unplug(q);
-#if defined(Q_WS_MAC) && !defined(QT_MAC_USE_COCOA)
- if (q->isWindow()) {
- setWindowState(true, true); //set it to floating
- }
-#endif
Q_ASSERT(state->widgetItem != 0);
}
state->dragging = !moving;
if (!layout->plug(state->widgetItem)) {
if (q->isFloatable()) {
layout->restore();
-#if defined(Q_WS_X11) || defined(Q_WS_MAC)
+#if defined(Q_WS_X11)
setWindowState(true); // gets rid of the X11BypassWindowManager window flag
// and activates the resizer
#endif
QStyleOptionToolBar opt;
q->initStyleOption(&opt);
if (q->style()->subElementRect(QStyle::SE_ToolBarHandle, &opt, q).contains(event->pos()) == false) {
-#ifdef Q_WS_MAC
- // When using the unified toolbar on Mac OS X the user can can click and
- // drag between toolbar contents to move the window. Make this work by
- // implementing the standard mouse-dragging code and then call
- // window->move() in mouseMoveEvent below.
- if (QMainWindow *mainWindow = qobject_cast<QMainWindow *>(parent)) {
- if (mainWindow->toolBarArea(q) == Qt::TopToolBarArea
- && mainWindow->unifiedTitleAndToolBarOnMac()
- && q->childAt(event->pos()) == 0) {
- macWindowDragging = true;
- macWindowDragPressPosition = event->pos();
- return true;
- }
- }
-#endif
return false;
}
if (state != 0) {
endDrag();
return true;
- } else {
-#ifdef Q_WS_MAC
- if (!macWindowDragging)
- return false;
- macWindowDragging = false;
- macWindowDragPressPosition = QPoint();
- return true;
-#endif
- return false;
}
+ return false;
}
bool QToolBarPrivate::mouseMoveEvent(QMouseEvent *event)
Q_Q(QToolBar);
if (!state) {
-#ifdef Q_WS_MAC
- if (!macWindowDragging)
- return false;
- QWidget *w = q->window();
- const QPoint delta = event->pos() - macWindowDragPressPosition;
- w->move(w->pos() + delta);
- return true;
-#endif
return false;
}
*/
QToolBar::~QToolBar()
{
- // Remove the toolbar button if there is nothing left.
- QMainWindow *mainwindow = qobject_cast<QMainWindow *>(parentWidget());
- if (mainwindow) {
-#ifdef Q_WS_MAC
- QMainWindowLayout *mainwin_layout = qt_mainwindow_layout(mainwindow);
- if (mainwin_layout && mainwin_layout->layoutState.toolBarAreaLayout.isEmpty()
- && mainwindow->testAttribute(Qt::WA_WState_Created))
- macWindowToolbarShow(mainwindow, false);
-#endif
- }
}
/*! \property QToolBar::movable
Qt::ToolBarAreas QToolBar::allowedAreas() const
{
Q_D(const QToolBar);
-#ifdef Q_WS_MAC
- if (QMainWindow *window = qobject_cast<QMainWindow *>(parentWidget())) {
- if (window->unifiedTitleAndToolBarOnMac()) // Don't allow drags to the top (for now).
- return (d->allowedAreas & ~Qt::TopToolBarArea);
- }
-#endif
return d->allowedAreas;
}
return false;
}
-#if defined(Q_WS_MAC)
-static bool toolbarInUnifiedToolBar(QToolBar *toolbar)
-{
- const QMainWindow *mainWindow = qobject_cast<const QMainWindow *>(toolbar->parentWidget());
- return mainWindow && mainWindow->unifiedTitleAndToolBarOnMac()
- && mainWindow->toolBarArea(toolbar) == Qt::TopToolBarArea;
-}
-#endif
-
/*! \reimp */
bool QToolBar::event(QEvent *event)
{
case QEvent::Show:
d->toggleViewAction->setChecked(event->type() == QEvent::Show);
emit visibilityChanged(event->type() == QEvent::Show);
-#if defined(Q_WS_MAC)
- if (toolbarInUnifiedToolBar(this)) {
- // I can static_cast because I did the qobject_cast in the if above, therefore
- // we must have a QMainWindowLayout here.
- QMainWindowLayout *mwLayout = qt_mainwindow_layout(qobject_cast<QMainWindow *>(parentWidget()));
- mwLayout->fixSizeInUnifiedToolbar(this);
- mwLayout->syncUnifiedToolbarVisibility();
- }
-# if !defined(QT_MAC_USE_COCOA)
- // Fall through
- case QEvent::LayoutRequest: {
- // There's currently no way to invalidate the size and let
- // HIToolbar know about it. This forces a re-check.
- int earlyResult = -1;
- if (QMainWindow *mainWindow = qobject_cast<QMainWindow *>(parentWidget())) {
- bool needUpdate = true;
- if (event->type() == QEvent::LayoutRequest) {
- QSize oldSizeHint = sizeHint();
- earlyResult = QWidget::event(event) ? 1 : 0;
- needUpdate = oldSizeHint != sizeHint();
- }
-
- if (needUpdate) {
- OSWindowRef windowRef = qt_mac_window_for(mainWindow);
- if (toolbarInUnifiedToolBar(this)
- && macWindowToolbarIsVisible(windowRef)) {
- DisableScreenUpdates();
- macWindowToolbarShow(this, false);
- macWindowToolbarShow(this, true);
- EnableScreenUpdates();
- }
- }
-
- if (earlyResult != -1)
- return earlyResult;
- }
- }
-# endif // !QT_MAC_USE_COCOA
-#endif // Q_WS_MAC
break;
case QEvent::ParentChange:
d->layout->checkUsePopupMenu();
-#if defined(Q_WS_MAC)
- if (parentWidget() && parentWidget()->isWindow())
- qt_mac_updateToolBarButtonHint(parentWidget());
-#endif
break;
case QEvent::MouseButtonPress: {
if (d->mouseMoveEvent(static_cast<QMouseEvent*>(event)))
return true;
break;
-#ifdef Q_WS_WINCE
- case QEvent::ContextMenu:
- {
- QContextMenuEvent* contextMenuEvent = static_cast<QContextMenuEvent*>(event);
- QWidget* child = childAt(contextMenuEvent->pos());
- QAbstractButton* button = qobject_cast<QAbstractButton*>(child);
- if (button)
- button->setDown(false);
- }
- break;
-#endif
case QEvent::Leave:
- if (d->state != 0 && d->state->dragging) {
-#ifdef Q_OS_WIN
- // This is a workaround for loosing the mouse on Vista.
- QPoint pos = QCursor::pos();
- QMouseEvent fake(QEvent::MouseMove, mapFromGlobal(pos), pos, Qt::NoButton,
- QApplication::mouseButtons(), QApplication::keyboardModifiers());
- d->mouseMoveEvent(&fake);
-#endif
- } else {
+ if (!(d->state != 0 && d->state->dragging)) {
if (!d->layout->expanded)
break;