summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/kernel/qapplication_s60.cpp10
-rw-r--r--src/gui/kernel/qdesktopwidget_s60.cpp63
-rw-r--r--src/gui/kernel/qwidget.cpp23
-rw-r--r--src/gui/styles/qs60style.cpp82
-rw-r--r--src/gui/styles/qs60style_p.h22
-rw-r--r--src/gui/styles/qs60style_simulated.cpp42
-rw-r--r--src/gui/styles/qs60style_symbian.cpp84
-rw-r--r--src/gui/styles/styles.pri1
-rw-r--r--src/gui/text/qfont.cpp6
-rw-r--r--src/gui/widgets/qplaintextedit.cpp20
-rw-r--r--src/gui/widgets/qplaintextedit_p.h6
11 files changed, 200 insertions, 159 deletions
diff --git a/src/gui/kernel/qapplication_s60.cpp b/src/gui/kernel/qapplication_s60.cpp
index dd51fcd..5b2c1fb 100644
--- a/src/gui/kernel/qapplication_s60.cpp
+++ b/src/gui/kernel/qapplication_s60.cpp
@@ -14,6 +14,7 @@
#include "qevent.h"
#include "qeventdispatcher_s60_p.h"
#include "qwidget.h"
+#include "qdesktopwidget.h"
#include "private/qbackingstore_p.h"
#include "qt_s60_p.h"
#include "private/qevent_p.h"
@@ -49,6 +50,8 @@ static bool appNoGrab = false; // Grabbing enabled
Q_GUI_EXPORT QS60Data *qt_s60Data = 0;
extern bool qt_sendSpontaneousEvent(QObject*,QEvent*);
+extern QDesktopWidget *qt_desktopWidget; // qapplication.cpp
+
QWidget *qt_button_down = 0; // widget got last button-down
bool qt_nograb() // application no-grab option
@@ -988,6 +991,13 @@ int QApplication::s60ProcessEvent(TWsEvent *event)
case EEventScreenDeviceChanged:
if (S60)
S60->updateScreenSize();
+ if (qt_desktopWidget) {
+ QSize oldSize = qt_desktopWidget->size();
+ qt_desktopWidget->data->crect.setWidth(S60->screenWidthInPixels);
+ qt_desktopWidget->data->crect.setHeight(S60->screenHeightInPixels);
+ QResizeEvent e(qt_desktopWidget->size(), oldSize);
+ QApplication::sendEvent(qt_desktopWidget, &e);
+ }
return 0; // Propagate to CONE
case EEventWindowVisibilityChanged:
if (controlInMap) {
diff --git a/src/gui/kernel/qdesktopwidget_s60.cpp b/src/gui/kernel/qdesktopwidget_s60.cpp
index 029892e..d57d289 100644
--- a/src/gui/kernel/qdesktopwidget_s60.cpp
+++ b/src/gui/kernel/qdesktopwidget_s60.cpp
@@ -32,34 +32,58 @@ public:
static int screenCount;
static int primaryScreen;
+
+ static QVector<QRect> *rects;
+ static QVector<QRect> *workrects;
+
+ static int refcount;
};
int QDesktopWidgetPrivate::screenCount = 1;
int QDesktopWidgetPrivate::primaryScreen = 0;
+QVector<QRect> *QDesktopWidgetPrivate::rects = 0;
+QVector<QRect> *QDesktopWidgetPrivate::workrects = 0;
+int QDesktopWidgetPrivate::refcount = 0;
QDesktopWidgetPrivate::QDesktopWidgetPrivate()
{
+ ++refcount;
}
QDesktopWidgetPrivate::~QDesktopWidgetPrivate()
{
+ if (!--refcount)
+ cleanup();
}
void QDesktopWidgetPrivate::init(QDesktopWidget *that)
{
- TInt screenCount=0;
- TInt result=0;
+ int screenCount=0;
+
+ if (HAL::Get(0, HALData::EDisplayNumberOfScreens, screenCount) == KErrNone)
+ QDesktopWidgetPrivate::screenCount = screenCount;
+ else
+ QDesktopWidgetPrivate::screenCount = 0;
- result = HAL::Get(0, HALData::EDisplayNumberOfScreens, screenCount);
- QDesktopWidgetPrivate::screenCount = screenCount;
- if( result != KErrNone)
- {
- // ### What to do if no screens found?
- }
+ rects = new QVector<QRect>();
+ workrects = new QVector<QRect>();
+
+ rects->resize(QDesktopWidgetPrivate::screenCount);
+ workrects->resize(QDesktopWidgetPrivate::screenCount);
+
+ // ### TODO: Implement proper multi-display support
+ rects->resize(1);
+ rects->replace(0, that->rect());
+ workrects->resize(1);
+ workrects->replace(0, that->rect());
}
void QDesktopWidgetPrivate::cleanup()
{
+ delete rects;
+ rects = 0;
+ delete workrects;
+ workrects = 0;
}
@@ -120,6 +144,29 @@ int QDesktopWidget::screenNumber(const QPoint &point) const
void QDesktopWidget::resizeEvent(QResizeEvent *)
{
+ Q_D(QDesktopWidget);
+ QVector<QRect> oldrects;
+ oldrects = *d->rects;
+ QVector<QRect> oldworkrects;
+ oldworkrects = *d->workrects;
+ int oldscreencount = d->screenCount;
+
+ QDesktopWidgetPrivate::cleanup();
+ QDesktopWidgetPrivate::init(this);
+
+ for (int i = 0; i < qMin(oldscreencount, d->screenCount); ++i) {
+ QRect oldrect = oldrects[i];
+ QRect newrect = d->rects->at(i);
+ if (oldrect != newrect)
+ emit resized(i);
+ }
+
+ for (int j = 0; j < qMin(oldscreencount, d->screenCount); ++j) {
+ QRect oldrect = oldworkrects[j];
+ QRect newrect = d->workrects->at(j);
+ if (oldrect != newrect)
+ emit workAreaResized(j);
+ }
}
QT_END_NAMESPACE
diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp
index dae4179..4fcedb4 100644
--- a/src/gui/kernel/qwidget.cpp
+++ b/src/gui/kernel/qwidget.cpp
@@ -2046,17 +2046,20 @@ static inline void fillRegion(QPainter *painter, const QRegion &rgn, const QPoin
// Defined in qmacstyle_mac.cpp
extern void qt_mac_fill_background(QPainter *painter, const QRegion &rgn, const QPoint &offset, const QBrush &brush);
qt_mac_fill_background(painter, rgn, offset, brush);
-#elif defined(Q_WS_S60)
- // Defined in qs60style_symbian.cpp
- extern void qt_s60_fill_background(QPainter *painter, const QRegion &rgn,
- const QPoint &offset, const QBrush &brush);
- qt_s60_fill_background(painter, rgn, offset, brush);
#else
- const QRegion translated = rgn.translated(offset);
- const QRect rect(translated.boundingRect());
- painter->setClipRegion(translated);
- painter->drawTiledPixmap(rect, brush.texture(), rect.topLeft());
-#endif
+#if !defined(QT_NO_STYLE_S60)
+ // Defined in qs60style.cpp
+ extern bool qt_s60_fill_background(QPainter *painter, const QRegion &rgn,
+ const QPoint &offset, const QBrush &brush);
+ if (!qt_s60_fill_background(painter, rgn, offset, brush))
+#endif // !defined(QT_NO_STYLE_S60)
+ {
+ const QRegion translated = rgn.translated(offset);
+ const QRect rect(translated.boundingRect());
+ painter->setClipRegion(translated);
+ painter->drawTiledPixmap(rect, brush.texture(), rect.topLeft());
+ }
+#endif // Q_WS_MAC
} else {
const QVector<QRect> &rects = rgn.rects();
for (int i = 0; i < rects.size(); ++i)
diff --git a/src/gui/styles/qs60style.cpp b/src/gui/styles/qs60style.cpp
index 071b60a..b066967 100644
--- a/src/gui/styles/qs60style.cpp
+++ b/src/gui/styles/qs60style.cpp
@@ -57,7 +57,6 @@ const QS60StylePrivate::SkinElementFlags QS60StylePrivate::KDefaultSkinElementFl
static const QByteArray propertyKeyLayouts = "layouts";
static const QByteArray propertyKeyCurrentlayout = "currentlayout";
-#if defined(QT_S60STYLE_LAYOUTDATA_SIMULATED)
const layoutHeader QS60StylePrivate::m_layoutHeaders[] = {
// *** generated layout data ***
{240,320,1,14,true,QLatin1String("QVGA Landscape Mirrored")},
@@ -93,9 +92,9 @@ const short QS60StylePrivate::data[][MAX_PIXELMETRICS] = {
};
const short *QS60StylePrivate::m_pmPointer = QS60StylePrivate::data[0];
-#endif // defined(QT_S60STYLE_LAYOUTDATA_SIMULATED)
-bool QS60StylePrivate::m_backgroundValid = false;
+// theme background texture
+QPixmap *QS60StylePrivate::m_background = 0;
const struct QS60StylePrivate::frameElementCenter QS60StylePrivate::m_frameElementsData[] = {
{SE_ButtonNormal, QS60StyleEnums::SP_QsnFrButtonTbCenter},
@@ -118,6 +117,11 @@ static const int frameElementsCount =
const int KNotFound = -1;
+QS60StylePrivate::~QS60StylePrivate()
+{
+ deleteBackground();
+}
+
void QS60StylePrivate::drawSkinElement(SkinElements element, QPainter *painter,
const QRect &rect, SkinElementFlags flags)
{
@@ -251,10 +255,18 @@ void QS60StylePrivate::drawSkinPart(QS60StyleEnums::SkinParts part,
drawPart(part, painter, rect, flags);
}
+short QS60StylePrivate::pixelMetric(int metric)
+{
+ Q_ASSERT(metric < MAX_PIXELMETRICS);
+ const short returnValue = m_pmPointer[metric];
+ if (returnValue==-909)
+ return -1;
+ return returnValue;
+}
+
void QS60StylePrivate::setStyleProperty(const char *name, const QVariant &value)
{
if (name == propertyKeyCurrentlayout) {
-#if !defined(QT_WS_S60) || defined(QT_S60STYLE_LAYOUTDATA_SIMULATED)
static const QStringList layouts = styleProperty(propertyKeyLayouts).toStringList();
const QString layout = value.toString();
Q_ASSERT(layouts.contains(layout));
@@ -264,24 +276,17 @@ void QS60StylePrivate::setStyleProperty(const char *name, const QVariant &value)
clearCaches();
refreshUI();
return;
-#else
- qFatal("Cannot set static layout. Dynamic layouts are used!");
-#endif
}
}
QVariant QS60StylePrivate::styleProperty(const char *name) const
{
if (name == propertyKeyLayouts) {
-#if !defined(QT_WS_S60) || defined(QT_S60STYLE_LAYOUTDATA_SIMULATED)
static QStringList layouts;
if (layouts.isEmpty())
for (int i = 0; i < QS60StylePrivate::m_numberOfLayouts; i++)
layouts.append(QS60StylePrivate::m_layoutHeaders[i].layoutName);
return layouts;
-#else
- qFatal("Cannot return list of 'canned' static layouts. Dynamic layouts are used!");
-#endif
}
return QVariant();
}
@@ -352,25 +357,25 @@ QFont QS60StylePrivate::s60Font(
void QS60StylePrivate::clearCaches(QS60StylePrivate::CacheClearReason reason)
{
- switch(reason){
+ switch(reason){
case CC_LayoutChange:
// when layout changes, the colors remain in cache, but graphics and fonts can change
m_mappedFontsCache.clear();
- m_backgroundValid = false;
+ deleteBackground();
QPixmapCache::clear();
break;
case CC_ThemeChange:
m_colorCache.clear();
QPixmapCache::clear();
- m_backgroundValid = false;
+ deleteBackground();
case CC_UndefinedChange:
default:
m_colorCache.clear();
m_mappedFontsCache.clear();
QPixmapCache::clear();
- m_backgroundValid = false;
+ deleteBackground();
break;
- }
+ }
}
// Since S60Style has 'button' and 'tooltip' as a graphic, we don't have any native color which to use
@@ -561,18 +566,23 @@ void QS60StylePrivate::setBackgroundTexture(QApplication *app) const
app->setPalette(applicationPalette);
}
+void QS60StylePrivate::deleteBackground()
+{
+ if (QS60StylePrivate::m_background) {
+ delete QS60StylePrivate::m_background;
+ QS60StylePrivate::m_background = 0;
+ }
+}
+
int QS60StylePrivate::focusRectPenWidth()
{
return pixelMetric(QS60Style::PM_DefaultFrameWidth);
}
-#if !defined(QT_WS_S60) || defined(QT_S60STYLE_LAYOUTDATA_SIMULATED)
void QS60StylePrivate::setCurrentLayout(int index)
{
m_pmPointer = data[index];
}
-#endif
-
void QS60StylePrivate::drawPart(QS60StyleEnums::SkinParts skinPart,
QPainter *painter, const QRect &rect, SkinElementFlags flags)
@@ -1314,16 +1324,14 @@ void QS60Style::drawControl(ControlElement element, const QStyleOption *option,
(listView->selectionMode() == QAbstractItemView::SingleSelection ||
listView->selectionMode() == QAbstractItemView::NoSelection);
QRect selectionRect = subElementRect(SE_ItemViewItemCheckIndicator, &voptAdj, widget);
- if (voptAdj.state & QStyle::State_Selected &&
- !singleSelection) {
+ if (voptAdj.state & QStyle::State_Selected && !singleSelection) {
QStyleOptionViewItemV4 option(voptAdj);
option.rect = selectionRect;
// Draw selection mark.
drawPrimitive(QStyle::PE_IndicatorViewItemCheck, &option, painter, widget);
if ( textRect.right() > selectionRect.left() )
textRect.setRight(selectionRect.left());
- }
- else if (singleSelection &&
+ } else if (singleSelection &&
voptAdj.features & QStyleOptionViewItemV2::HasCheckIndicator) {
// draw the check mark
if (selectionRect.isValid()) {
@@ -2178,7 +2186,6 @@ int QS60Style::pixelMetric(PixelMetric metric, const QStyleOption *option, const
metricValue = QCommonStyle::pixelMetric(metric, option, widget);
if (metric == PM_SubMenuOverlap && widget){
- const int widgetWidth = widget->width();
const QMenu *menu = qobject_cast<const QMenu *>(widget);
if (menu && menu->activeAction() && menu->activeAction()->menu()) {
const int menuWidth = menu->activeAction()->menu()->sizeHint().width();
@@ -2408,11 +2415,12 @@ QRect QS60Style::subControlRect(ComplexControl control, const QStyleOptionComple
ret = QCommonStyle::subControlRect(control, option, scontrol, widget);
switch (scontrol) {
case SC_GroupBoxCheckBox: //fallthrough
- case SC_GroupBoxLabel:
+ case SC_GroupBoxLabel: {
//slightly indent text and boxes, so that dialog border does not mess with them.
const int horizontalSpacing =
QS60StylePrivate::pixelMetric(QStyle::PM_LayoutHorizontalSpacing);
ret.adjust(2,horizontalSpacing-3,0,0);
+ }
break;
case SC_GroupBoxFrame: {
const QRect textBox = subControlRect(control, option, SC_GroupBoxLabel, widget);
@@ -2678,6 +2686,7 @@ void QS60Style::polish(QApplication *application)
void QS60Style::unpolish(QApplication *application)
{
+ Q_UNUSED(application)
QPalette newPalette = qApp->style()->standardPalette();
application->setPalette(newPalette);
QApplicationPrivate::setSystemPalette(originalPalette);
@@ -2780,6 +2789,29 @@ QIcon QS60Style::standardIconImplementation(StandardPixmap standardIcon,
QCommonStyle::standardIconImplementation(standardIcon, option, widget) : QIcon(cachedPixMap);
}
+extern QPoint qt_s60_fill_background_offset(const QWidget *targetWidget);
+
+bool qt_s60_fill_background(QPainter *painter, const QRegion &rgn, const QPoint &offset,
+ const QBrush &brush)
+{
+ const QPixmap backgroundTexture(QS60StylePrivate::backgroundTexture());
+ if (backgroundTexture.cacheKey() != brush.texture().cacheKey())
+ return false;
+
+ const QPaintDevice *target = painter->device();
+ if (target->devType() == QInternal::Widget) {
+ const QWidget *widget = static_cast<const QWidget *>(target);
+ const QRegion translated = rgn.translated(offset);
+ const QVector<QRect> &rects = translated.rects();
+ for (int i = 0; i < rects.size(); ++i) {
+ const QRect rect(rects.at(i));
+ painter->drawPixmap(rect.topLeft(), backgroundTexture,
+ rect.translated(qt_s60_fill_background_offset(widget)));
+ }
+ }
+ return true;
+}
+
QT_END_NAMESPACE
#endif // QT_NO_STYLE_S60 || QT_PLUGIN
diff --git a/src/gui/styles/qs60style_p.h b/src/gui/styles/qs60style_p.h
index ba7dca3..22b01f6 100644
--- a/src/gui/styles/qs60style_p.h
+++ b/src/gui/styles/qs60style_p.h
@@ -331,13 +331,13 @@ public:
SF_StateDisabled = 0x0020,
SF_ColorSkinned = 0x0040,
};
-
+
enum CacheClearReason {
CC_UndefinedChange = 0,
CC_LayoutChange,
CC_ThemeChange
};
-
+
Q_DECLARE_FLAGS(SkinElementFlags, SkinElementFlag)
// draws skin element
@@ -373,8 +373,10 @@ public:
int pointSize = -1) const;
// clears all style caches (fonts, colors, pixmaps)
void clearCaches(CacheClearReason reason = CC_UndefinedChange);
- // returns themed background texture
- static QPixmap backgroundTexture();
+
+ // themed main background oprations
+ void setBackgroundTexture(QApplication *application) const;
+ static void deleteBackground();
static bool isTouchSupported();
static bool isToolBarBackground();
@@ -383,11 +385,9 @@ public:
QColor colorFromFrameGraphics(QS60StylePrivate::SkinFrameElements frame) const;
void setThemePalette(QApplication *application) const;
void setThemePalette(QWidget *widget) const;
- void setBackgroundTexture(QApplication *application) const;
static int focusRectPenWidth();
-#if defined(QT_S60STYLE_LAYOUTDATA_SIMULATED)
static const layoutHeader m_layoutHeaders[];
static const short data[][MAX_PIXELMETRICS];
@@ -397,7 +397,6 @@ public:
static short const *m_pmPointer;
// number of layouts supported by the style
static const int m_numberOfLayouts;
-#endif // defined(QT_S60STYLE_LAYOUTDATA_SIMULATED)
mutable QHash<QPair<QS60StyleEnums::FontCategories , int>, QFont> m_mappedFontsCache;
mutable QHash<QS60StylePrivate::SkinFrameElements, QColor> m_colorCache;
@@ -411,6 +410,8 @@ public:
static QPixmap frame(SkinFrameElements frame, const QSize &size,
SkinElementFlags flags = KDefaultSkinElementFlags);
+ static QPixmap backgroundTexture();
+
private:
static void drawPart(QS60StyleEnums::SkinParts part, QPainter *painter,
const QRect &rect, SkinElementFlags flags = KDefaultSkinElementFlags);
@@ -424,9 +425,9 @@ private:
SkinElementFlags flags = KDefaultSkinElementFlags);
static QPixmap cachedFrame(SkinFrameElements frame, const QSize &size,
SkinElementFlags flags = KDefaultSkinElementFlags);
-
+
static void refreshUI();
-
+
static QSize partSize(QS60StyleEnums::SkinParts part,
SkinElementFlags flags = KDefaultSkinElementFlags);
static QPixmap part(QS60StyleEnums::SkinParts part, const QSize &size,
@@ -436,7 +437,8 @@ private:
static QSize screenSize();
- static bool m_backgroundValid;
+ // Contains background texture.
+ static QPixmap *m_background;
const static SkinElementFlags KDefaultSkinElementFlags;
};
diff --git a/src/gui/styles/qs60style_simulated.cpp b/src/gui/styles/qs60style_simulated.cpp
index 65336ae..b6ad0ac 100644
--- a/src/gui/styles/qs60style_simulated.cpp
+++ b/src/gui/styles/qs60style_simulated.cpp
@@ -42,19 +42,6 @@ QS60StylePrivate::QS60StylePrivate()
setCurrentLayout(0);
}
-QS60StylePrivate::~QS60StylePrivate()
-{
-}
-
-short QS60StylePrivate::pixelMetric(int metric)
-{
- Q_ASSERT(metric < MAX_PIXELMETRICS);
- const short returnValue = m_pmPointer[metric];
- if (returnValue==-909)
- return -1;
- return returnValue;
-}
-
QColor QS60StylePrivate::s60Color(QS60StyleEnums::ColorLists list,
int index, const QStyleOption *option)
{
@@ -193,24 +180,15 @@ QVariant QS60StylePrivate::styleProperty_specific(const char *name) const
QPixmap QS60StylePrivate::backgroundTexture()
{
- static QPixmap result;
- // Poor mans caching. + Making sure that there is always only one background image in memory at a time
-
-/*
- TODO: 1) Hold the background QPixmap as pointer in a static class member.
- Also add a deleteBackground() function and call that in ~QS60StylePrivate()
- 2) Don't cache the background at all as soon as we have native pixmap support
-*/
-
- if (!m_backgroundValid) {
- result = QPixmap();
- const QSize size = QApplication::activeWindow()?QApplication::activeWindow()->size():QSize(100, 100);
- result = part(QS60StyleEnums::SP_QsnBgScreen, size);
- m_backgroundValid = true;
+ if (!m_background) {
+ const QSize size = QApplication::desktop()->screen()->size();
+ QPixmap background = part(QS60StyleEnums::SP_QsnBgScreen, size);
+ m_background = new QPixmap(background);
}
- return result;
+ return *m_background;
}
+
bool QS60StylePrivate::isTouchSupported()
{
#ifdef QT_KEYPAD_NAVIGATION
@@ -225,7 +203,6 @@ bool QS60StylePrivate::isToolBarBackground()
return true;
}
-
QFont QS60StylePrivate::s60Font_specific(QS60StyleEnums::FontCategories fontCategory, int pointSize)
{
QFont result;
@@ -290,6 +267,13 @@ void QS60Style::setS60Theme(const QHash<QString, QPicture> &parts,
QS60StyleModeSpecifics::m_partPictures = parts;
QS60StyleModeSpecifics::m_colors = colors;
d->clearCaches(QS60StylePrivate::CC_ThemeChange);
+ d->setBackgroundTexture(qApp);
+}
+
+QPoint qt_s60_fill_background_offset(const QWidget *targetWidget)
+{
+ Q_UNUSED(targetWidget)
+ return QPoint();
}
QT_END_NAMESPACE
diff --git a/src/gui/styles/qs60style_symbian.cpp b/src/gui/styles/qs60style_symbian.cpp
index 3fc4c8c..ddee4ba 100644
--- a/src/gui/styles/qs60style_symbian.cpp
+++ b/src/gui/styles/qs60style_symbian.cpp
@@ -583,26 +583,6 @@ QPixmap QS60StyleModeSpecifics::fromFbsBitmap(CFbsBitmap *icon, CFbsBitmap *mask
return QPixmap::fromImage(iconImage);
}
-QPixmap QS60StylePrivate::backgroundTexture()
-{
- static QPixmap result;
- // Poor mans caching. + Making sure that there is always only one background image in memory at a time
-
-/*
- TODO: 1) Hold the background QPixmap as pointer in a static class member.
- Also add a deleteBackground() function and call that in ~QS60StylePrivate()
- 2) Don't cache the background at all as soon as we have native pixmap support
-*/
-
- if (!m_backgroundValid) {
- result = QPixmap();
- result = part(QS60StyleEnums::SP_QsnBgScreen,
- QSize(S60->screenWidthInPixels, S60->screenHeightInPixels), SkinElementFlags());
- m_backgroundValid = true;
- }
- return result;
-}
-
bool QS60StylePrivate::isTouchSupported()
{
return bool(AknLayoutUtils::PenEnabled());
@@ -613,30 +593,11 @@ bool QS60StylePrivate::isToolBarBackground()
return (QSysInfo::s60Version() == QSysInfo::SV_S60_3_1 || QSysInfo::s60Version() == QSysInfo::SV_S60_3_2);
}
-void qt_s60_fill_background(QPainter *painter, const QRegion &rgn, const QPoint &offset,
- const QBrush &brush)
+QPoint qt_s60_fill_background_offset(const QWidget *targetWidget)
{
- const QPixmap backgroundTexture(QS60StylePrivate::backgroundTexture());
- if (backgroundTexture.cacheKey() == brush.texture().cacheKey()) {
- const QPaintDevice *target = painter->device();
- if (target->devType() == QInternal::Widget) {
- const QWidget *widget = static_cast<const QWidget *>(target);
- CCoeControl *control = widget->effectiveWinId();
- TPoint globalPos = control ? control->PositionRelativeToScreen() : TPoint(0,0);
- const QRegion translated = rgn.translated(offset);
- const QVector<QRect> &rects = translated.rects();
- for (int i = 0; i < rects.size(); ++i) {
- const QRect rect(rects.at(i));
- painter->drawPixmap(rect.topLeft(), backgroundTexture,
- rect.translated(globalPos.iX, globalPos.iY));
- }
- }
- } else {
- const QRegion translated = rgn.translated(offset);
- const QRect rect(translated.boundingRect());
- painter->setClipRegion(translated);
- painter->drawTiledPixmap(rect, brush.texture(), rect.topLeft());
- }
+ CCoeControl *control = targetWidget->effectiveWinId();
+ TPoint globalPos = control ? control->PositionRelativeToScreen() : TPoint(0,0);
+ return QPoint(globalPos.iX, globalPos.iY);
}
QPixmap QS60StyleModeSpecifics::createSkinnedGraphicsL(
@@ -959,7 +920,6 @@ QFont QS60StylePrivate::s60Font_specific(
return result;
}
-#ifdef QT_S60STYLE_LAYOUTDATA_SIMULATED
void QS60StylePrivate::setActiveLayout()
{
const QSize activeScreenSize(screenSize());
@@ -975,7 +935,7 @@ void QS60StylePrivate::setActiveLayout()
break;
}
}
-
+
//not found, lets try without mirroring info
if (activeLayoutIndex==-1){
for (int i=0; i<m_numberOfLayouts; i++) {
@@ -999,19 +959,11 @@ void QS60StylePrivate::setActiveLayout()
m_pmPointer = data[activeLayoutIndex];
}
-#endif // QT_S60STYLE_LAYOUTDATA_SIMULATED
QS60StylePrivate::QS60StylePrivate()
{
-#ifdef QT_S60STYLE_LAYOUTDATA_SIMULATED
// No need to set active layout, if dynamic metrics API is available
setActiveLayout();
-#endif // QT_S60STYLE_LAYOUTDATA_SIMULATED
-}
-
-QS60StylePrivate::~QS60StylePrivate()
-{
- m_backgroundValid = false;
}
void QS60StylePrivate::setStyleProperty_specific(const char *name, const QVariant &value)
@@ -1031,20 +983,6 @@ QVariant QS60StylePrivate::styleProperty_specific(const char *name) const
return styleProperty(name);
}
-short QS60StylePrivate::pixelMetric(int metric)
-{
-#ifdef QT_S60STYLE_LAYOUTDATA_SIMULATED
- Q_ASSERT(metric < MAX_PIXELMETRICS);
- const short returnValue = m_pmPointer[metric];
- if (returnValue==-909)
- return -1;
- return returnValue;
-#else
- //todo - call the pixelmetrics API directly
- return 0;
-#endif // QT_S60STYLE_LAYOUTDATA_SIMULATED
-}
-
QColor QS60StylePrivate::s60Color(QS60StyleEnums::ColorLists list,
int index, const QStyleOption *option)
{
@@ -1183,6 +1121,16 @@ QPixmap QS60StylePrivate::frame(SkinFrameElements frame, const QSize &size, Skin
return result;
}
+QPixmap QS60StylePrivate::backgroundTexture()
+{
+ if (!m_background) {
+ QPixmap background = part(QS60StyleEnums::SP_QsnBgScreen,
+ QSize(S60->screenWidthInPixels, S60->screenHeightInPixels), SkinElementFlags());
+ m_background = new QPixmap(background);
+ }
+ return *m_background;
+}
+
// If the public SDK returns compressed images, please let us also uncompress those!
void QS60StyleModeSpecifics::unCompressBitmapL(const TRect& aTrgRect, CFbsBitmap* aTrgBitmap, CFbsBitmap* aSrcBitmap)
{
@@ -1353,9 +1301,7 @@ void QS60Style::handleDynamicLayoutVariantSwitch()
{
Q_D(QS60Style);
d->clearCaches(QS60StylePrivate::CC_LayoutChange);
-#ifdef QT_S60STYLE_LAYOUTDATA_SIMULATED
d->setActiveLayout();
-#endif // QT_S60STYLE_LAYOUTDATA_SIMULATED
d->refreshUI();
d->setBackgroundTexture(qApp);
foreach (QWidget *widget, QApplication::allWidgets())
diff --git a/src/gui/styles/styles.pri b/src/gui/styles/styles.pri
index 9aa170e..b0e9f21 100644
--- a/src/gui/styles/styles.pri
+++ b/src/gui/styles/styles.pri
@@ -160,7 +160,6 @@ contains( styles, s60 ) {
styles/qs60style.h \
styles/qs60style_p.h
SOURCES += styles/qs60style.cpp
- DEFINES += QT_S60STYLE_LAYOUTDATA_SIMULATED
symbian {
SOURCES += styles/qs60style_symbian.cpp
# TODO: fix the following LIBS hack. Line 1 is for armv5, 2 for winscw
diff --git a/src/gui/text/qfont.cpp b/src/gui/text/qfont.cpp
index 4d316f6..930e8af 100644
--- a/src/gui/text/qfont.cpp
+++ b/src/gui/text/qfont.cpp
@@ -173,8 +173,7 @@ Q_GUI_EXPORT int qt_defaultDpiX()
screen = subScreens.at(0);
dpi = qRound(screen->width() / (screen->physicalWidth() / qreal(25.4)));
#elif defined(Q_WS_S60)
- const TReal inchWidth = (TReal)S60->screenWidthInTwips / KTwipsPerInch;
- dpi = S60->screenWidthInPixels / inchWidth;
+ dpi = S60->defaultDpiX;
#endif // Q_WS_X11
return dpi;
@@ -202,8 +201,7 @@ Q_GUI_EXPORT int qt_defaultDpiY()
screen = subScreens.at(0);
dpi = qRound(screen->height() / (screen->physicalHeight() / qreal(25.4)));
#elif defined(Q_WS_S60)
- const TReal inchHeight = (TReal)S60->screenHeightInTwips / KTwipsPerInch;
- dpi = S60->screenHeightInPixels / inchHeight;
+ dpi = S60->defaultDpiY;
#endif // Q_WS_X11
return dpi;
diff --git a/src/gui/widgets/qplaintextedit.cpp b/src/gui/widgets/qplaintextedit.cpp
index e563fa1..3d2c4f5 100644
--- a/src/gui/widgets/qplaintextedit.cpp
+++ b/src/gui/widgets/qplaintextedit.cpp
@@ -72,6 +72,11 @@
QT_BEGIN_NAMESPACE
+static inline bool shouldEnableInputMethod(QPlainTextEdit *plaintextedit)
+{
+ return !plaintextedit->isReadOnly();
+}
+
class QPlainTextDocumentLayoutPrivate : public QAbstractTextDocumentLayoutPrivate
{
Q_DECLARE_PUBLIC(QPlainTextDocumentLayout)
@@ -705,7 +710,8 @@ QPlainTextEditPrivate::QPlainTextEditPrivate()
tabChangesFocus(false),
lineWrap(QPlainTextEdit::WidgetWidth),
wordWrap(QTextOption::WrapAtWordBoundaryOrAnywhere),
- topLine(0), pageUpDownLastCursorYIsValid(false)
+ clickCausedFocus(0),topLine(0),
+ pageUpDownLastCursorYIsValid(false)
{
showCursorOnInitialShow = true;
backgroundVisible = false;
@@ -1905,6 +1911,13 @@ void QPlainTextEdit::mouseReleaseEvent(QMouseEvent *e)
d->autoScrollTimer.stop();
d->ensureCursorVisible();
}
+
+ if (e->button() == Qt::LeftButton && qApp->autoSipEnabled()
+ && (!d->clickCausedFocus || qApp->autoSipOnMouseFocus())) {
+ QEvent event(QEvent::RequestSoftwareInputPanel);
+ QApplication::sendEvent(this, &event);
+ }
+ d->clickCausedFocus = 0;
}
/*! \reimp
@@ -2038,6 +2051,9 @@ QVariant QPlainTextEdit::inputMethodQuery(Qt::InputMethodQuery property) const
void QPlainTextEdit::focusInEvent(QFocusEvent *e)
{
Q_D(QPlainTextEdit);
+ if (e->reason() == Qt::MouseFocusReason) {
+ d->clickCausedFocus = 1;
+ }
QAbstractScrollArea::focusInEvent(e);
d->sendControlEvent(e);
}
@@ -2304,7 +2320,7 @@ void QPlainTextEdit::setReadOnly(bool ro)
} else {
flags = Qt::TextEditorInteraction;
}
- setAttribute(Qt::WA_InputMethodEnabled, !ro);
+ setAttribute(Qt::WA_InputMethodEnabled, shouldEnableInputMethod(this));
d->control->setTextInteractionFlags(flags);
}
diff --git a/src/gui/widgets/qplaintextedit_p.h b/src/gui/widgets/qplaintextedit_p.h
index 0739d53..56a3aa9 100644
--- a/src/gui/widgets/qplaintextedit_p.h
+++ b/src/gui/widgets/qplaintextedit_p.h
@@ -91,7 +91,10 @@ public:
return r;
}
inline QRectF cursorRect() { return cursorRect(textCursor()); }
- void ensureCursorVisible() { textEdit->ensureCursorVisible(); }
+ void ensureCursorVisible() {
+ textEdit->ensureCursorVisible();
+ emit microFocusChanged();
+ }
QPlainTextEdit *textEdit;
@@ -148,6 +151,7 @@ public:
uint backgroundVisible : 1;
uint centerOnScroll : 1;
uint inDrag : 1;
+ uint clickCausedFocus : 1;
int topLine;