summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--examples/widgets/softkeys/softkeys.cpp16
-rw-r--r--examples/widgets/softkeys/softkeys.h2
-rw-r--r--examples/xml/saxbookmarks/mainwindow.cpp7
-rw-r--r--src/gui/kernel/qapplication_s60.cpp56
-rw-r--r--src/gui/kernel/qwidget.cpp30
-rw-r--r--src/gui/painting/qbackingstore.cpp2
-rw-r--r--src/gui/styles/qs60style.cpp23
-rw-r--r--src/gui/styles/qs60style_p.h11
-rw-r--r--src/gui/widgets/qmainwindow.cpp1
-rw-r--r--src/gui/widgets/qmenu.cpp12
-rw-r--r--tests/auto/qwidget/tst_qwidget.cpp38
11 files changed, 120 insertions, 78 deletions
diff --git a/examples/widgets/softkeys/softkeys.cpp b/examples/widgets/softkeys/softkeys.cpp
index 69b4941..d1586a5 100644
--- a/examples/widgets/softkeys/softkeys.cpp
+++ b/examples/widgets/softkeys/softkeys.cpp
@@ -66,11 +66,11 @@ MainWindow::MainWindow(QWidget *parent)
infoLabel = new QLabel(tr(""), this);
infoLabel->setContextMenuPolicy(Qt::NoContextMenu);
- toggleButton = new QPushButton(tr("Custom softkeys"), this);
+ toggleButton = new QPushButton(tr("Custom"), this);
toggleButton->setContextMenuPolicy(Qt::NoContextMenu);
toggleButton->setCheckable(true);
- pushButton = new QPushButton(tr("Open File Dialog"), this);
+ pushButton = new QPushButton(tr("File Dialog"), this);
pushButton->setContextMenuPolicy(Qt::NoContextMenu);
QComboBox* comboBox = new QComboBox(this);
@@ -81,12 +81,12 @@ MainWindow::MainWindow(QWidget *parent)
<< QApplication::translate("MainWindow", "Selection3", 0, QApplication::UnicodeUTF8)
);
- layout = new QVBoxLayout;
- layout->addWidget(textEditor);
- layout->addWidget(infoLabel);
- layout->addWidget(toggleButton);
- layout->addWidget(pushButton);
- layout->addWidget(comboBox);
+ layout = new QGridLayout;
+ layout->addWidget(textEditor, 0, 0, 1, 2);
+ layout->addWidget(infoLabel, 1, 0, 1, 2);
+ layout->addWidget(toggleButton, 2, 0);
+ layout->addWidget(pushButton, 2, 1);
+ layout->addWidget(comboBox, 3, 0, 1, 2);
central->setLayout(layout);
fileMenu = menuBar()->addMenu(tr("&File"));
diff --git a/examples/widgets/softkeys/softkeys.h b/examples/widgets/softkeys/softkeys.h
index 178ae64..1372fa4 100644
--- a/examples/widgets/softkeys/softkeys.h
+++ b/examples/widgets/softkeys/softkeys.h
@@ -61,7 +61,7 @@ public:
MainWindow(QWidget *parent = 0);
~MainWindow();
private:
- QVBoxLayout *layout;
+ QGridLayout *layout;
QWidget *central;
QTextEdit* textEditor;
QLabel *infoLabel;
diff --git a/examples/xml/saxbookmarks/mainwindow.cpp b/examples/xml/saxbookmarks/mainwindow.cpp
index 49cb468..ff3cf11 100644
--- a/examples/xml/saxbookmarks/mainwindow.cpp
+++ b/examples/xml/saxbookmarks/mainwindow.cpp
@@ -67,8 +67,11 @@ MainWindow::MainWindow()
void MainWindow::open()
{
#if defined(Q_OS_SYMBIAN)
- // Always look for bookmarks on the same drive where the application is installed to.
- QString bookmarksFolder = QCoreApplication::applicationFilePath().left(1);
+ // Look for bookmarks on the same drive where the application is installed to,
+ // if drive is not read only. QDesktopServices::DataLocation does this check,
+ // and returns writable drive.
+ QString bookmarksFolder =
+ QDesktopServices::storageLocation(QDesktopServices::DataLocation).left(1);
bookmarksFolder.append(":/Data/qt/saxbookmarks");
QDir::setCurrent(bookmarksFolder);
#endif
diff --git a/src/gui/kernel/qapplication_s60.cpp b/src/gui/kernel/qapplication_s60.cpp
index fb2bc72..89d961c 100644
--- a/src/gui/kernel/qapplication_s60.cpp
+++ b/src/gui/kernel/qapplication_s60.cpp
@@ -133,36 +133,46 @@ private:
TTimeIntervalMicroSeconds iDuration;
};
+static QS60Beep* qt_S60Beep = 0;
+
QS60Beep::~QS60Beep()
{
+ if (iToneUtil) {
+ switch (iState) {
+ case EBeepPlaying:
+ iToneUtil->CancelPlay();
+ break;
+ case EBeepNotPrepared:
+ iToneUtil->CancelPrepare();
+ break;
+ }
+ }
delete iToneUtil;
}
QS60Beep* QS60Beep::NewL(TInt aFrequency, TTimeIntervalMicroSeconds aDuration)
{
- QS60Beep* self=new (ELeave) QS60Beep();
+ QS60Beep* self = new (ELeave) QS60Beep();
CleanupStack::PushL(self);
self->ConstructL(aFrequency, aDuration);
CleanupStack::Pop();
return self;
-};
+}
void QS60Beep::ConstructL(TInt aFrequency, TTimeIntervalMicroSeconds aDuration)
{
- iToneUtil=CMdaAudioToneUtility::NewL(*this);
- iState=EBeepNotPrepared;
- iFrequency=aFrequency;
- iDuration=aDuration;
- iToneUtil->PrepareToPlayTone(iFrequency,iDuration);
+ iToneUtil = CMdaAudioToneUtility::NewL(*this);
+ iState = EBeepNotPrepared;
+ iFrequency = aFrequency;
+ iDuration = aDuration;
+ iToneUtil->PrepareToPlayTone(iFrequency, iDuration);
}
void QS60Beep::Play()
{
- if (iState != EBeepNotPrepared) {
- if (iState == EBeepPlaying) {
- iToneUtil->CancelPlay();
- iState = EBeepPrepared;
- }
+ if (iState == EBeepPlaying) {
+ iToneUtil->CancelPlay();
+ iState = EBeepPrepared;
}
iToneUtil->Play();
@@ -173,13 +183,14 @@ void QS60Beep::MatoPrepareComplete(TInt aError)
{
if (aError == KErrNone) {
iState = EBeepPrepared;
+ Play();
}
}
void QS60Beep::MatoPlayComplete(TInt aError)
{
Q_UNUSED(aError);
- iState=EBeepPrepared;
+ iState = EBeepPrepared;
}
@@ -1226,6 +1237,10 @@ void qt_init(QApplicationPrivate * /* priv */, int)
*****************************************************************************/
void qt_cleanup()
{
+ if(qt_S60Beep) {
+ delete qt_S60Beep;
+ qt_S60Beep = 0;
+ }
QFontCache::cleanup(); // Has to happen now, since QFontEngineS60 has FBS handles
// S60 structure and window server session are freed in eventdispatcher destructor as they are needed there
@@ -1467,14 +1482,13 @@ void QApplication::setCursorFlashTime(int msecs)
void QApplication::beep()
{
- TInt frequency=440;
- TTimeIntervalMicroSeconds duration(500000);
- QS60Beep* beep=NULL;
- TRAPD(err, beep=QS60Beep::NewL(frequency, duration));
- if (!err)
- beep->Play();
- delete beep;
- beep=NULL;
+ if (!qt_S60Beep) {
+ TInt frequency = 880;
+ TTimeIntervalMicroSeconds duration(500000);
+ TRAP_IGNORE(qt_S60Beep=QS60Beep::NewL(frequency, duration));
+ }
+ if (qt_S60Beep)
+ qt_S60Beep->Play();
}
/*!
diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp
index fbb9115..b389054 100644
--- a/src/gui/kernel/qwidget.cpp
+++ b/src/gui/kernel/qwidget.cpp
@@ -4605,7 +4605,7 @@ void QWidgetPrivate::updateFont(const QFont &font)
if (!q->parentWidget() && extra && extra->proxyWidget) {
QGraphicsProxyWidget *p = extra->proxyWidget;
inheritedFontResolveMask = p->d_func()->inheritedFontResolveMask | p->font().resolve();
- } else
+ } else
#endif //QT_NO_GRAPHICSVIEW
if (q->isWindow() && !q->testAttribute(Qt::WA_WindowPropagation)) {
inheritedFontResolveMask = 0;
@@ -9897,13 +9897,13 @@ void QWidget::scroll(int dx, int dy)
Q_D(QWidget);
#ifndef QT_NO_GRAPHICSVIEW
if (QGraphicsProxyWidget *proxy = QWidgetPrivate::nearestGraphicsProxyWidget(this)) {
- // Graphics View maintains its own dirty region as a list of rects;
- // until we can connect item updates directly to the view, we must
- // separately add a translated dirty region.
- if (!d->dirty.isEmpty()) {
- foreach (const QRect &rect, (d->dirty.translated(dx, dy)).rects())
- proxy->update(rect);
- }
+ // Graphics View maintains its own dirty region as a list of rects;
+ // until we can connect item updates directly to the view, we must
+ // separately add a translated dirty region.
+ if (!d->dirty.isEmpty()) {
+ foreach (const QRect &rect, (d->dirty.translated(dx, dy)).rects())
+ proxy->update(rect);
+ }
proxy->scroll(dx, dy, proxy->subWidgetRect(this));
return;
}
@@ -9932,13 +9932,13 @@ void QWidget::scroll(int dx, int dy, const QRect &r)
Q_D(QWidget);
#ifndef QT_NO_GRAPHICSVIEW
if (QGraphicsProxyWidget *proxy = QWidgetPrivate::nearestGraphicsProxyWidget(this)) {
- // Graphics View maintains its own dirty region as a list of rects;
- // until we can connect item updates directly to the view, we must
- // separately add a translated dirty region.
- if (!d->dirty.isEmpty()) {
- foreach (const QRect &rect, (d->dirty.translated(dx, dy) & r).rects())
- proxy->update(rect);
- }
+ // Graphics View maintains its own dirty region as a list of rects;
+ // until we can connect item updates directly to the view, we must
+ // separately add a translated dirty region.
+ if (!d->dirty.isEmpty()) {
+ foreach (const QRect &rect, (d->dirty.translated(dx, dy) & r).rects())
+ proxy->update(rect);
+ }
proxy->scroll(dx, dy, r.translated(proxy->subWidgetRect(this).topLeft().toPoint()));
return;
}
diff --git a/src/gui/painting/qbackingstore.cpp b/src/gui/painting/qbackingstore.cpp
index 8226797..1b8f413 100644
--- a/src/gui/painting/qbackingstore.cpp
+++ b/src/gui/painting/qbackingstore.cpp
@@ -949,6 +949,8 @@ void QWidgetPrivate::scrollRect(const QRect &rect, int dx, int dy)
return;
QWidgetBackingStore *wbs = x->backingStore;
+ if (!wbs)
+ return;
static int accelEnv = -1;
if (accelEnv == -1) {
diff --git a/src/gui/styles/qs60style.cpp b/src/gui/styles/qs60style.cpp
index ee10ff6..dca78ca 100644
--- a/src/gui/styles/qs60style.cpp
+++ b/src/gui/styles/qs60style.cpp
@@ -144,7 +144,7 @@ const struct QS60StylePrivate::frameElementCenter QS60StylePrivate::m_frameEleme
{SE_ToolBarButtonPressed, QS60StyleEnums::SP_QsnFrSctrlButtonCenterPressed},
{SE_PanelBackground, QS60StyleEnums::SP_QsnFrSetOptCenter},
{SE_ButtonInactive, QS60StyleEnums::SP_QsnFrButtonCenterInactive},
- {SE_Editor, QS60StyleEnums::SP_QsnFrNotepadCenter},
+ {SE_Editor, QS60StyleEnums::SP_QsnFrInputCenter},
};
static const int frameElementsCount =
@@ -459,11 +459,6 @@ void QS60StylePrivate::setThemePalette(QApplication *app) const
storeThemePalette(&widgetPalette);
}
-void QS60StylePrivate::setThemePalette(QStyleOption *option) const
-{
- setThemePalette(&option->palette);
-}
-
QPalette* QS60StylePrivate::themePalette()
{
return m_themePalette;
@@ -640,16 +635,16 @@ void QS60StylePrivate::setThemePalette(QWidget *widget) const
{
if(!widget)
return;
- QPalette widgetPalette = QApplication::palette(widget);
//header view and its viewport need to be set 100% transparent button color, since drawing code will
//draw transparent theme graphics to table column and row headers.
if (qobject_cast<QHeaderView *>(widget)){
+ QPalette widgetPalette = QApplication::palette(widget);
widgetPalette.setColor(QPalette::Active, QPalette::ButtonText,
s60Color(QS60StyleEnums::CL_QsnTextColors, 23, 0));
QHeaderView* header = qobject_cast<QHeaderView *>(widget);
widgetPalette.setColor(QPalette::Button, Qt::transparent );
- if ( header->viewport() )
+ if (header->viewport())
header->viewport()->setPalette(widgetPalette);
QApplication::setPalette(widgetPalette, "QHeaderView");
}
@@ -812,7 +807,7 @@ QSize QS60StylePrivate::partSize(QS60StyleEnums::SkinParts part, SkinElementFlag
case QS60StyleEnums::SP_QgnGrafTabActiveL:
//Returned QSize for tabs must not be square, but narrow rectangle with width:height
//ratio of 1:2 for horizontal tab bars (and 2:1 for vertical ones).
- result.setWidth(10);
+ result.setWidth(result.height()>>1);
break;
case QS60StyleEnums::SP_QgnIndiSliderEdit:
result.scale(pixelMetric(QStyle::PM_SliderLength),
@@ -870,7 +865,7 @@ QSize QS60StylePrivate::partSize(QS60StyleEnums::SkinParts part, SkinElementFlag
return result;
}
-bool QS60StylePrivate::canDrawThemeBackground(const QBrush &backgroundBrush)
+bool QS60StylePrivate::canDrawThemeBackground(const QBrush &backgroundBrush)
{
//If brush is not changed from style's default values, draw theme graphics.
return (backgroundBrush.color() == Qt::transparent ||
@@ -1788,7 +1783,7 @@ void QS60Style::drawControl(ControlElement element, const QStyleOption *option,
if (qobject_cast<const QAbstractButton *>(widget)) {
//Make cornerButton slightly smaller so that it is not on top of table border graphic.
QStyleOptionHeader subopt = *header;
- const int borderTweak =
+ const int borderTweak =
QS60StylePrivate::pixelMetric(PM_Custom_FrameCornerWidth)>>1;
if (subopt.direction == Qt::LeftToRight)
subopt.rect.adjust(borderTweak, borderTweak, 0, -borderTweak);
@@ -1881,7 +1876,7 @@ void QS60Style::drawControl(ControlElement element, const QStyleOption *option,
adjustableFlags = (adjustableFlags | QS60StylePrivate::SF_PointWest);
} else {
const int frameWidth = QS60StylePrivate::pixelMetric(PM_DefaultFrameWidth);
- if (option->direction == Qt::LeftToRight)
+ if (option->direction == Qt::LeftToRight)
headerRect.adjust(-2*frameWidth, 0, 0, 0);
else
headerRect.adjust(0, 0, 2*frameWidth, 0);
@@ -2027,7 +2022,7 @@ void QS60Style::drawPrimitive(PrimitiveElement element, const QStyleOption *opti
buttonRect.setHeight((int)(buttonRect.height() * scaler));
// move the rect up for half of the new height-gain
const int newY = (buttonRect.bottomRight().y() - option->rect.bottomRight().y()) >> 1 ;
- buttonRect.adjust(0,-newY,0,-newY);
+ buttonRect.adjust(0, -newY, -1, -newY);
painter->save();
QColor themeColor = d->s60Color(QS60StyleEnums::CL_QsnTextColors, 6, option);
@@ -2596,7 +2591,7 @@ QRect QS60Style::subControlRect(ComplexControl control, const QStyleOptionComple
const int indicatorRect = pixelMetric(PM_MenuButtonIndicator) + 2*pixelMetric(PM_ButtonMargin);
const int border = pixelMetric(PM_ButtonMargin) + pixelMetric(PM_DefaultFrameWidth);
ret = toolButton->rect;
- const bool popup = (toolButton->features &
+ const bool popup = (toolButton->features &
(QStyleOptionToolButton::MenuButtonPopup | QStyleOptionToolButton::PopupDelay))
== QStyleOptionToolButton::MenuButtonPopup;
switch (scontrol) {
diff --git a/src/gui/styles/qs60style_p.h b/src/gui/styles/qs60style_p.h
index ea86bb2..5ab2308 100644
--- a/src/gui/styles/qs60style_p.h
+++ b/src/gui/styles/qs60style_p.h
@@ -271,15 +271,6 @@ public:
SP_QsnFrButtonSideLInactive,
SP_QsnFrButtonSideRInactive,
SP_QsnFrButtonCenterInactive,
- SP_QsnFrNotepadCornerTl,
- SP_QsnFrNotepadCornerTr,
- SP_QsnFrNotepadCornerBl,
- SP_QsnFrNotepadCornerBr,
- SP_QsnFrNotepadSideT,
- SP_QsnFrNotepadSideB,
- SP_QsnFrNotepadSideL,
- SP_QsnFrNotepadSideR,
- SP_QsnFrNotepadCenter
};
enum ColorLists {
@@ -418,8 +409,6 @@ public:
//set theme palette for application
void setThemePalette(QApplication *application) const;
- //set theme palette for style option
- void setThemePalette(QStyleOption *option) const;
//access to theme palette
static QPalette* themePalette();
diff --git a/src/gui/widgets/qmainwindow.cpp b/src/gui/widgets/qmainwindow.cpp
index 501e62f..557acfb 100644
--- a/src/gui/widgets/qmainwindow.cpp
+++ b/src/gui/widgets/qmainwindow.cpp
@@ -120,6 +120,7 @@ void QMainWindowPrivate::init()
#ifdef QT_SOFTKEYS_ENABLED
menuBarAction = QSoftKeyManager::createAction(QSoftKeyManager::MenuSoftKey, q);
menuBarAction->setObjectName(QLatin1String("_q_menuSoftKeyAction"));
+ menuBarAction->setVisible(false);
#endif
}
diff --git a/src/gui/widgets/qmenu.cpp b/src/gui/widgets/qmenu.cpp
index 761a060..2e27226 100644
--- a/src/gui/widgets/qmenu.cpp
+++ b/src/gui/widgets/qmenu.cpp
@@ -229,7 +229,7 @@ void QMenuPrivate::updateActionRects() const
Q_Q(const QMenu);
if (!itemsDirty)
return;
-
+
q->ensurePolished();
//let's reinitialize the buffer
@@ -292,7 +292,7 @@ void QMenuPrivate::updateActionRects() const
if (!action->isVisible() ||
(collapsibleSeparators && previousWasSeparator && action->isSeparator()))
continue; // we continue, this action will get an empty QRect
-
+
previousWasSeparator = action->isSeparator();
//let the style modify the above size..
@@ -1139,7 +1139,7 @@ void QMenuPrivate::_q_actionTriggered()
//we check the parent hierarchy
QList< QPointer<QWidget> > list;
for(QWidget *widget = q->parentWidget(); widget; ) {
- if (qobject_cast<QMenu*>(widget)
+ if (qobject_cast<QMenu*>(widget)
#ifndef QT_NO_MENUBAR
|| qobject_cast<QMenuBar*>(widget)
#endif
@@ -1306,7 +1306,7 @@ void QMenu::initStyleOption(QStyleOptionMenuItem *option, const QAction *action)
the addAction(), addActions() and insertAction() functions. An action
is represented vertically and rendered by QStyle. In addition, actions
can have a text label, an optional icon drawn on the very left side,
- and shortcut key sequence such as "Ctrl+X".
+ and shortcut key sequence such as "Ctrl+X".
The existing actions held by a menu can be found with actions().
@@ -1906,9 +1906,9 @@ void QMenu::popup(const QPoint &p, QAction *atAction)
pos.setX(qMax(p.x()-size.width(), screen.right()-desktopFrame-size.width()+1));
} else {
if (pos.x()+size.width()-1 > screen.right()-desktopFrame)
- pos.setX(qMin(p.x()+size.width(), screen.right()-desktopFrame-size.width()+1));
+ pos.setX(screen.right()-desktopFrame-size.width()+1);
if (pos.x() < screen.left()+desktopFrame)
- pos.setX(qMax(p.x(), screen.left() + desktopFrame));
+ pos.setX(screen.left() + desktopFrame);
}
if (pos.y() + size.height() - 1 > screen.bottom() - desktopFrame) {
if(snapToMouse)
diff --git a/tests/auto/qwidget/tst_qwidget.cpp b/tests/auto/qwidget/tst_qwidget.cpp
index 1e3f5f8..9960f47 100644
--- a/tests/auto/qwidget/tst_qwidget.cpp
+++ b/tests/auto/qwidget/tst_qwidget.cpp
@@ -391,6 +391,7 @@ private slots:
#endif
void focusProxyAndInputMethods();
+ void scrollWithoutBackingStore();
private:
bool ensureScreenSize(int width, int height);
@@ -9703,5 +9704,42 @@ void tst_QWidget::focusProxyAndInputMethods()
delete toplevel;
}
+class scrollWidgetWBS : public QWidget
+{
+public:
+ void deleteBackingStore()
+ {
+ if (static_cast<QWidgetPrivate*>(d_ptr.data())->maybeBackingStore()) {
+ delete static_cast<QWidgetPrivate*>(d_ptr.data())->topData()->backingStore;
+ static_cast<QWidgetPrivate*>(d_ptr.data())->topData()->backingStore = 0;
+ }
+ }
+ void enableBackingStore()
+ {
+ if (!static_cast<QWidgetPrivate*>(d_ptr.data())->maybeBackingStore()) {
+ static_cast<QWidgetPrivate*>(d_ptr.data())->topData()->backingStore = new QWidgetBackingStore(this);
+ static_cast<QWidgetPrivate*>(d_ptr.data())->invalidateBuffer(this->rect());
+ repaint();
+ }
+ }
+};
+
+void tst_QWidget::scrollWithoutBackingStore()
+{
+ scrollWidgetWBS scrollable;
+ scrollable.resize(100,100);
+ QLabel child(QString("@"),&scrollable);
+ child.resize(50,50);
+ scrollable.show();
+ QTest::qWaitForWindowShown(&scrollable);
+ scrollable.scroll(50,50);
+ QCOMPARE(child.pos(),QPoint(50,50));
+ scrollable.deleteBackingStore();
+ scrollable.scroll(-25,-25);
+ QCOMPARE(child.pos(),QPoint(25,25));
+ scrollable.enableBackingStore();
+ QCOMPARE(child.pos(),QPoint(25,25));
+}
+
QTEST_MAIN(tst_QWidget)
#include "tst_qwidget.moc"