static QPlatformScreen *screenForDevice(QPaintDevice *device)
{
- QPlatformIntegration *pi = QApplicationPrivate::platformIntegration();
+ QPlatformIntegration *pi = QGuiApplicationPrivate::platformIntegration();
QList<QPlatformScreen *> screens = pi->screens();
\sa QWidget::setFocus(), QWidget::clearFocus(), Qt::FocusReason
*/
-/*!
- \since 4.5
- \fn void QApplication::fontDatabaseChanged()
-
- This signal is emitted when application fonts are loaded or removed.
-
- \sa QFontDatabase::addApplicationFont(),
- QFontDatabase::addApplicationFontFromData(),
- QFontDatabase::removeAllApplicationFonts(),
- QFontDatabase::removeApplicationFont()
-*/
#ifndef QT_NO_TRANSLATION
#if defined(Q_WS_MAC)
friend class QTextControl;
#endif
friend class QAction;
- friend class QFontDatabasePrivate;
#if defined(Q_WS_QWS)
friend class QInputContext;
QWidget *QApplication::topLevelAt(const QPoint &pos)
{
- QPlatformIntegration *pi = QApplicationPrivate::platformIntegration();
+ QPlatformIntegration *pi = QGuiApplicationPrivate::platformIntegration();
QList<QPlatformScreen *> screens = pi->screens();
QList<QPlatformScreen *>::const_iterator screen = screens.constBegin();
QPlatformNativeInterface *QApplication::platformNativeInterface()
{
- QPlatformIntegration *pi = QApplicationPrivate::platformIntegration();
+ QPlatformIntegration *pi = QGuiApplicationPrivate::platformIntegration();
return pi->nativeInterface();
}
const QMimeData* QClipboard::mimeData(Mode mode) const
{
- QPlatformClipboard *clipboard = QApplicationPrivate::platformIntegration()->clipboard();
+ QPlatformClipboard *clipboard = QGuiApplicationPrivate::platformIntegration()->clipboard();
if (!clipboard->supportsMode(mode)) return 0;
return clipboard->mimeData(mode);
}
void QClipboard::setMimeData(QMimeData* src, Mode mode)
{
- QPlatformClipboard *clipboard = QApplicationPrivate::platformIntegration()->clipboard();
+ QPlatformClipboard *clipboard = QGuiApplicationPrivate::platformIntegration()->clipboard();
if (!clipboard->supportsMode(mode)) return;
clipboard->setMimeData(src,mode);
bool QClipboard::supportsMode(Mode mode) const
{
- QPlatformClipboard *clipboard = QApplicationPrivate::platformIntegration()->clipboard();
+ QPlatformClipboard *clipboard = QGuiApplicationPrivate::platformIntegration()->clipboard();
return clipboard->supportsMode(mode);
}
void QDesktopWidgetPrivate::updateScreenList()
{
- QList<QPlatformScreen *> screenList = QApplicationPrivate::platformIntegration()->screens();
+ QList<QPlatformScreen *> screenList = QGuiApplicationPrivate::platformIntegration()->screens();
int targetLength = screenList.length();
int currentLength = screens.length();
}
QRegion virtualGeometry;
- bool doVirtualGeometry = QApplicationPrivate::platformIntegration()->isVirtualDesktop();
+ bool doVirtualGeometry = QGuiApplicationPrivate::platformIntegration()->isVirtualDesktop();
// update the geometry of each screen widget
for (int i = 0; i < screens.length(); i++) {
bool QDesktopWidget::isVirtualDesktop() const
{
- return QApplicationPrivate::platformIntegration()->isVirtualDesktop();
+ return QGuiApplicationPrivate::platformIntegration()->isVirtualDesktop();
}
int QDesktopWidget::primaryScreen() const
int QDesktopWidget::numScreens() const
{
- QPlatformIntegration *pi = QApplicationPrivate::platformIntegration();
+ QPlatformIntegration *pi = QGuiApplicationPrivate::platformIntegration();
return qMax(pi->screens().size(), 1);
}
QWidget *QDesktopWidget::screen(int screen)
{
Q_D(QDesktopWidget);
- if (QApplicationPrivate::platformIntegration()->isVirtualDesktop())
+ if (QGuiApplicationPrivate::platformIntegration()->isVirtualDesktop())
return &d->virtualScreen;
if (screen < 0 || screen >= d->screens.length())
return d->screens.at(0);
const QRect QDesktopWidget::availableGeometry(int screenNo) const
{
- QPlatformIntegration *pi = QApplicationPrivate::platformIntegration();
+ QPlatformIntegration *pi = QGuiApplicationPrivate::platformIntegration();
QList<QPlatformScreen *> screens = pi->screens();
if (screenNo == -1)
screenNo = 0;
const QRect QDesktopWidget::screenGeometry(int screenNo) const
{
- QPlatformIntegration *pi = QApplicationPrivate::platformIntegration();
+ QPlatformIntegration *pi = QGuiApplicationPrivate::platformIntegration();
QList<QPlatformScreen *> screens = pi->screens();
if (screenNo == -1)
screenNo = 0;
int QDesktopWidget::screenNumber(const QPoint &p) const
{
- QPlatformIntegration *pi = QApplicationPrivate::platformIntegration();
+ QPlatformIntegration *pi = QGuiApplicationPrivate::platformIntegration();
QList<QPlatformScreen *> screens = pi->screens();
for (int i = 0; i < screens.size(); ++i)
{
static bool init = false;
if (!init) {
- if (QApplicationPrivate::platformIntegration()->createEventLoopIntegration()) {
+ if (QGuiApplicationPrivate::platformIntegration()->createEventLoopIntegration()) {
qWarning("Eventloop integration is not supported by the glib event dispatcher");
qWarning("Use the UNIX event dispatcher by defining environment variable QT_NO_GLIB=1");
}
if (!m_integrationInitialised) {
QEventDispatcherQPAPrivate *that = const_cast<QEventDispatcherQPAPrivate *>(this);
if (qApp && (qApp->thread() == QThread::currentThread())) { // guiThread
- if (QApplicationPrivate::platformIntegration()) {
- that->eventLoopIntegration = QApplicationPrivate::platformIntegration()->createEventLoopIntegration();
+ if (QGuiApplicationPrivate::platformIntegration()) {
+ that->eventLoopIntegration = QGuiApplicationPrivate::platformIntegration()->createEventLoopIntegration();
if (that->eventLoopIntegration) {
that->selectWorker = new SelectWorker(that);
that->barrierBeforeBlocking = new Rendezvous;
return layout_direction;
}
+/*!
+ \since 4.5
+ \fn void QGuiApplication::fontDatabaseChanged()
+
+ This signal is emitted when application fonts are loaded or removed.
+
+ \sa QFontDatabase::addApplicationFont(),
+ QFontDatabase::addApplicationFontFromData(),
+ QFontDatabase::removeAllApplicationFonts(),
+ QFontDatabase::removeApplicationFont()
+*/
QT_END_NAMESPACE
static int exec();
bool notify(QObject *, QEvent *);
+Q_SIGNALS:
+ void fontDatabaseChanged();
+
protected:
bool event(QEvent *);
bool compressEvent(QEvent *, QObject *receiver, QPostEventList *);
#ifndef QT_NO_GESTURES
friend class QGestureManager;
#endif
+ friend class QFontDatabasePrivate;
};
QT_END_NAMESPACE
if (topData)
screenIndex = topData->screenIndex;
QPlatformIntegration *integration =
- QApplicationPrivate::platformIntegration();
+ QGuiApplicationPrivate::platformIntegration();
return integration->screens()[screenIndex];
}
#elif defined(Q_WS_QPA)
if (desktopWidget) {
int screen = desktopWidget->d_func()->topData()->screenIndex;
- QPlatformIntegration *platform = QApplicationPrivate::platformIntegration();
+ QPlatformIntegration *platform = QGuiApplicationPrivate::platformIntegration();
platform->moveToScreen(q, screen);
}
#else
if (!surface ) {
if (win) {
- surface = QApplicationPrivate::platformIntegration()->createWindowSurface(win, win->winId());
+ surface = QGuiApplicationPrivate::platformIntegration()->createWindowSurface(win, win->winId());
q->setWindowSurface(surface);
} else {
q->setAttribute(Qt::WA_PaintOnScreen,true);
}
}
- QApplicationPrivate::platformIntegration()->moveToScreen(q, topData()->screenIndex);
+ QGuiApplicationPrivate::platformIntegration()->moveToScreen(q, topData()->screenIndex);
// qDebug() << "create_sys" << q << q->internalWinId();
}
maybeTopData()->screenIndex = targetScreen;
// only if it is already created
if (q->testAttribute(Qt::WA_WState_Created)) {
- QPlatformIntegration *platform = QApplicationPrivate::platformIntegration();
+ QPlatformIntegration *platform = QGuiApplicationPrivate::platformIntegration();
platform->moveToScreen(q, targetScreen);
}
}
{
Q_D(QWindow);
if (!d->platformWindow) {
- d->platformWindow = QApplicationPrivate::platformIntegration()->createPlatformWindow(this);
+ d->platformWindow = QGuiApplicationPrivate::platformIntegration()->createPlatformWindow(this);
d->windowFlags = d->platformWindow->setWindowFlags(d->windowFlags);
if (!d->windowTitle.isNull())
d->platformWindow->setWindowTitle(d->windowTitle);
#include "qpainter.h"
#include "qhash.h"
#include "qdatastream.h"
-#include "qapplication.h"
+#include "qguiapplication.h"
#include "qstringlist.h"
#include "qthread.h"
#endif
#ifdef Q_WS_QPA
#include <QtGui/qplatformscreen_qpa.h>
-#include <QtGui/private/qapplication_p.h>
+#include <QtGui/private/qguiapplication_p.h>
#endif
#include <QMutexLocker>
screen = subScreens.at(0);
dpi = qRound(screen->width() / (screen->physicalWidth() / qreal(25.4)));
#elif defined(Q_WS_QPA)
- QPlatformIntegration *pi = QApplicationPrivate::platformIntegration();
+ QPlatformIntegration *pi = QGuiApplicationPrivate::platformIntegration();
if (pi) {
- QPlatformScreen *screen = QApplicationPrivate::platformIntegration()->screens().at(0);
+ QPlatformScreen *screen = pi->screens().at(0);
const QSize screenSize = screen->geometry().size();
const QSize physicalSize = screen->physicalSize();
dpi = qRound(screenSize.width() / (physicalSize.width() / qreal(25.4)));
screen = subScreens.at(0);
dpi = qRound(screen->height() / (screen->physicalHeight() / qreal(25.4)));
#elif defined(Q_WS_QPA)
- QPlatformIntegration *pi = QApplicationPrivate::platformIntegration();
+ QPlatformIntegration *pi = QGuiApplicationPrivate::platformIntegration();
if (pi) {
- QPlatformScreen *screen = QApplicationPrivate::platformIntegration()->screens().at(0);
+ QPlatformScreen *screen = pi->screens().at(0);
const QSize screenSize = screen->geometry().size();
const QSize physicalSize = screen->physicalSize();
dpi = qRound(screenSize.height() / (physicalSize.height() / qreal(25.4)));
Use QFontMetrics to get measurements, e.g. the pixel length of a
string using QFontMetrics::width().
- Note that a QApplication instance must exist before a QFont can be
+ Note that a QGuiApplication instance must exist before a QFont can be
used. You can set the application's default font with
- QApplication::setFont().
+ QGuiApplication::setFont().
If a chosen font does not include all the characters that
need to be displayed, QFont will try to find the characters in the
/*!
Constructs a font object that uses the application's default font.
- \sa QApplication::setFont(), QApplication::font()
+ \sa QGuiApplication::setFont(), QGuiApplication::font()
*/
QFont::QFont()
- : d(QApplication::font().d.data()), resolve_mask(0)
+ : d(QGuiApplication::font().d.data()), resolve_mask(0)
{
}
algorithm.
\sa Weight, setFamily(), setPointSize(), setWeight(), setItalic(),
- setStyleHint() QApplication::font()
+ setStyleHint() QGuiApplication::font()
*/
QFont::QFont(const QString &family, int pointSize, int weight, bool italic)
: d(new QFontPrivate()), resolve_mask(QFont::FamilyResolved)
**
****************************************************************************/
-#include <QtGui/private/qapplication_p.h>
+#include <QtGui/private/qguiapplication_p.h>
#include <QtGui/QPlatformFontDatabase>
QT_BEGIN_NAMESPACE
void QFont::initialize()
{
- QApplicationPrivate::platformIntegration()->fontDatabase()->populateFontDatabase();
+ QGuiApplicationPrivate::platformIntegration()->fontDatabase()->populateFontDatabase();
}
void QFont::cleanup()
familyName = QString::fromLatin1("helvetica");
}
- QStringList list = QApplicationPrivate::platformIntegration()->fontDatabase()->fallbacksForFamily(familyName,QFont::StyleNormal,QFont::StyleHint(d->request.styleHint),QUnicodeTables::Common);
+ QStringList list = QGuiApplicationPrivate::platformIntegration()->fontDatabase()->fallbacksForFamily(familyName,QFont::StyleNormal,QFont::StyleHint(d->request.styleHint),QUnicodeTables::Common);
if (list.size()) {
familyName = list.at(0);
}
#include "qfontdatabase.h"
#include "qdebug.h"
#include "qalgorithms.h"
-#include "qapplication.h"
+#include "qguiapplication.h"
#include "qvarlengtharray.h" // here or earlier - workaround for VC++6
#include "qthread.h"
#include "qmutex.h"
#include "qfontengine_p.h"
#ifdef Q_WS_QPA
-#include <QtGui/private/qapplication_p.h>
+#include <QtGui/private/qguiapplication_p.h>
#include <QtGui/qplatformfontdatabase_qpa.h>
#include "qabstractfileengine.h"
#endif
// Test in decreasing order of commonness
if (s == QLatin1String("medium") ||
s == QLatin1String("normal")
- || s.compare(QApplication::translate("QFontDatabase", "Normal"), Qt::CaseInsensitive) == 0)
+ || s.compare(QCoreApplication::translate("QFontDatabase", "Normal"), Qt::CaseInsensitive) == 0)
return QFont::Normal;
if (s == QLatin1String("bold")
- || s.compare(QApplication::translate("QFontDatabase", "Bold"), Qt::CaseInsensitive) == 0)
+ || s.compare(QCoreApplication::translate("QFontDatabase", "Bold"), Qt::CaseInsensitive) == 0)
return QFont::Bold;
if (s == QLatin1String("demibold") || s == QLatin1String("demi bold")
- || s.compare(QApplication::translate("QFontDatabase", "Demi Bold"), Qt::CaseInsensitive) == 0)
+ || s.compare(QCoreApplication::translate("QFontDatabase", "Demi Bold"), Qt::CaseInsensitive) == 0)
return QFont::DemiBold;
if (s == QLatin1String("black")
- || s.compare(QApplication::translate("QFontDatabase", "Black"), Qt::CaseInsensitive) == 0)
+ || s.compare(QCoreApplication::translate("QFontDatabase", "Black"), Qt::CaseInsensitive) == 0)
return QFont::Black;
if (s == QLatin1String("light"))
return QFont::Light;
if (s.contains(QLatin1String("bold"))
- || s.contains(QApplication::translate("QFontDatabase", "Bold"), Qt::CaseInsensitive)) {
+ || s.contains(QCoreApplication::translate("QFontDatabase", "Bold"), Qt::CaseInsensitive)) {
if (s.contains(QLatin1String("demi"))
- || s.compare(QApplication::translate("QFontDatabase", "Demi"), Qt::CaseInsensitive) == 0)
+ || s.compare(QCoreApplication::translate("QFontDatabase", "Demi"), Qt::CaseInsensitive) == 0)
return (int) QFont::DemiBold;
return (int) QFont::Bold;
}
if (s.contains(QLatin1String("light"))
- || s.compare(QApplication::translate("QFontDatabase", "Light"), Qt::CaseInsensitive) == 0)
+ || s.compare(QCoreApplication::translate("QFontDatabase", "Light"), Qt::CaseInsensitive) == 0)
return (int) QFont::Light;
if (s.contains(QLatin1String("black"))
- || s.compare(QApplication::translate("QFontDatabase", "Black"), Qt::CaseInsensitive) == 0)
+ || s.compare(QCoreApplication::translate("QFontDatabase", "Black"), Qt::CaseInsensitive) == 0)
return (int) QFont::Black;
return (int) QFont::Normal;
pixelSizes[count].fileName.~QByteArray();
#endif
#if defined (Q_WS_QPA)
- QPlatformIntegration *integration = QApplicationPrivate::platformIntegration();
+ QPlatformIntegration *integration = QGuiApplicationPrivate::platformIntegration();
if (integration) { //on shut down there will be some that we don't release.
integration->fontDatabase()->releaseHandle(pixelSizes[count].handle);
}
weight = getFontWeight(styleString);
if (styleString.contains(QLatin1String("Italic"))
- || styleString.contains(QApplication::translate("QFontDatabase", "Italic")))
+ || styleString.contains(QCoreApplication::translate("QFontDatabase", "Italic")))
style = QFont::StyleItalic;
else if (styleString.contains(QLatin1String("Oblique"))
- || styleString.contains(QApplication::translate("QFontDatabase", "Oblique")))
+ || styleString.contains(QCoreApplication::translate("QFontDatabase", "Oblique")))
style = QFont::StyleOblique;
}
{
QFontCache::instance()->clear();
free();
- emit static_cast<QApplication *>(QApplication::instance())->fontDatabaseChanged();
+ emit static_cast<QGuiApplication *>(QCoreApplication::instance())->fontDatabaseChanged();
}
QtFontFamily *QFontDatabasePrivate::family(const QString &f, bool create)
{
QString result;
if (weight >= QFont::Black)
- result = QApplication::translate("QFontDatabase", "Black");
+ result = QCoreApplication::translate("QFontDatabase", "Black");
else if (weight >= QFont::Bold)
- result = QApplication::translate("QFontDatabase", "Bold");
+ result = QCoreApplication::translate("QFontDatabase", "Bold");
else if (weight >= QFont::DemiBold)
- result = QApplication::translate("QFontDatabase", "Demi Bold");
+ result = QCoreApplication::translate("QFontDatabase", "Demi Bold");
else if (weight < QFont::Normal)
- result = QApplication::translate("QFontDatabase", "Light");
+ result = QCoreApplication::translate("QFontDatabase", "Light");
if (style == QFont::StyleItalic)
- result += QLatin1Char(' ') + QApplication::translate("QFontDatabase", "Italic");
+ result += QLatin1Char(' ') + QCoreApplication::translate("QFontDatabase", "Italic");
else if (style == QFont::StyleOblique)
- result += QLatin1Char(' ') + QApplication::translate("QFontDatabase", "Oblique");
+ result += QLatin1Char(' ') + QCoreApplication::translate("QFontDatabase", "Oblique");
if (result.isEmpty())
- result = QApplication::translate("QFontDatabase", "Normal");
+ result = QCoreApplication::translate("QFontDatabase", "Normal");
return result.simplified();
}
QtFontFoundry allStyles(foundryName);
QtFontFamily *f = d->family(familyName);
- if (!f) return QApplication::font();
+ if (!f) return QGuiApplication::font();
for (int j = 0; j < f->count; j++) {
QtFontFoundry *foundry = f->foundries[j];
QtFontStyle *s = bestStyle(&allStyles, styleKey);
if (!s) // no styles found?
- return QApplication::font();
+ return QGuiApplication::font();
QFont fnt(family, pointSize, s->key.weight);
fnt.setStyle((QFont::Style)s->key.style);
return fnt;
Q_ASSERT_X(false, "QFontDatabase::writingSystemName", "invalid 'writingSystem' parameter");
break;
}
- return QApplication::translate("QFontDatabase", name);
+ return QCoreApplication::translate("QFontDatabase", name);
}
#include "qfontengine_qpa_p.h"
#include "qplatformdefs.h"
-#include <QtGui/private/qapplication_p.h>
+#include <QtGui/private/qguiapplication_p.h>
#include <QtGui/qplatformfontdatabase_qpa.h>
#include <QtCore/qmath.h>
static QStringList fallbackFamilies(const QString &family, const QFont::Style &style, const QFont::StyleHint &styleHint, const QUnicodeTables::Script &script)
{
- QStringList retList = QApplicationPrivate::platformIntegration()->fontDatabase()->fallbacksForFamily(family,style,styleHint,script);
+ QStringList retList = QGuiApplicationPrivate::platformIntegration()->fontDatabase()->fallbacksForFamily(family,style,styleHint,script);
QFontDatabasePrivate *db = privateDb();
QStringList::iterator i;
if (!initialized) {
//init by asking for the platformfontdb for the first time :)
- QApplicationPrivate::platformIntegration()->fontDatabase()->populateFontDatabase();
+ QGuiApplicationPrivate::platformIntegration()->fontDatabase()->populateFontDatabase();
initialized = true;
}
}
-#ifndef QT_NO_SETTINGS
-// called from qapplication_qws.cpp
-void qt_applyFontDatabaseSettings(const QSettings &settings)
-{
- initializeDb();
- QFontDatabasePrivate *db = privateDb();
- for (int i = 0; i < db->count; ++i) {
- QtFontFamily *family = db->families[i];
- if (settings.contains(family->name))
- family->fallbackFamilies = settings.value(family->name).toStringList();
- }
-
- if (settings.contains(QLatin1String("Global Fallbacks")))
- db->fallbackFamilies = settings.value(QLatin1String("Global Fallbacks")).toStringList();
-}
-#endif // QT_NO_SETTINGS
-
static inline void load(const QString & = QString(), int = -1)
{
initializeDb();
QFontCache::Key key(def,script);
QFontEngine *engine = QFontCache::instance()->findEngine(key);
if (!engine) {
- QPlatformFontDatabase *pfdb = QApplicationPrivate::platformIntegration()->fontDatabase();
+ QPlatformFontDatabase *pfdb = QGuiApplicationPrivate::platformIntegration()->fontDatabase();
engine = pfdb->fontEngine(def,QUnicodeTables::Script(script),size->handle);
if (engine) {
QFontCache::Key key(def,script);
{
QFontDatabasePrivate *db = privateDb();
- fnt->families = QApplicationPrivate::platformIntegration()->fontDatabase()->addApplicationFont(fnt->data,fnt->fileName);
+ fnt->families = QGuiApplicationPrivate::platformIntegration()->fontDatabase()->addApplicationFont(fnt->data,fnt->fileName);
db->reregisterAppFonts = true;
}
family_list = familyList(req);
// add the default family
- QString defaultFamily = QApplication::font().family();
+ QString defaultFamily = QGuiApplication::font().family();
if (! family_list.contains(defaultFamily))
family_list << defaultFamily;