summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@nokia.com>2009-04-29 06:18:27 (GMT)
committerSimon Hausmann <simon.hausmann@nokia.com>2009-04-29 06:18:27 (GMT)
commit68999af7823e80aa049c19f332045b1fb074fb96 (patch)
treeb18b30c870157e1da14b8cf21568bb0d4684e0cf /src/gui
parentbad50f8a2ef285aa9943291400cd322a6ec7af82 (diff)
parent822114e976d7c6644f060ac366c08c92da1a4779 (diff)
downloadQt-68999af7823e80aa049c19f332045b1fb074fb96.zip
Qt-68999af7823e80aa049c19f332045b1fb074fb96.tar.gz
Qt-68999af7823e80aa049c19f332045b1fb074fb96.tar.bz2
Merge branch '4.5' of git@scm.dev.nokia.troll.no:qt/qt
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/dialogs/qfiledialog.cpp9
-rw-r--r--src/gui/dialogs/qmessagebox.cpp3
-rw-r--r--src/gui/itemviews/qabstractitemview.cpp2
-rw-r--r--src/gui/itemviews/qitemselectionmodel.cpp20
-rw-r--r--src/gui/kernel/qcocoaview_mac.mm4
-rw-r--r--src/gui/kernel/qcocoawindowdelegate_mac.mm17
-rw-r--r--src/gui/kernel/qwidget_mac.mm25
-rw-r--r--src/gui/painting/qpaintengine_x11.cpp4
8 files changed, 54 insertions, 30 deletions
diff --git a/src/gui/dialogs/qfiledialog.cpp b/src/gui/dialogs/qfiledialog.cpp
index 073c25b..2f524cb 100644
--- a/src/gui/dialogs/qfiledialog.cpp
+++ b/src/gui/dialogs/qfiledialog.cpp
@@ -96,9 +96,8 @@ Q_GUI_EXPORT _qt_filedialog_save_filename_hook qt_filedialog_save_filename_hook
order to select one or many files or a directory.
The easiest way to create a QFileDialog is to use the static
- functions. On Windows, these static functions will call the native
- Windows file dialog, and on Mac OS X these static function will call
- the native Mac OS X file dialog.
+ functions. On Windows, Mac OS X, KDE and GNOME, these static functions will
+ call the native file dialog when possible.
\snippet doc/src/snippets/code/src_gui_dialogs_qfiledialog.cpp 0
@@ -216,7 +215,7 @@ Q_GUI_EXPORT _qt_filedialog_save_filename_hook qt_filedialog_save_filename_hook
are resolved.
\value DontConfirmOverwrite Don't ask for confirmation if an existing file is selected.
By default confirmation is requested.
- \value DontUseNativeDialog Don't use the native file dialog. By default on Mac OS X and Windows,
+ \value DontUseNativeDialog Don't use the native file dialog. By default on Mac OS X,
the native file dialog is used unless you use a subclass of QFileDialog that contains the
Q_OBJECT macro.
\value ReadOnly Indicates that the model is readonly.
@@ -2793,7 +2792,7 @@ void QFileDialogPrivate::_q_enterDirectory(const QModelIndex &index)
{
Q_Q(QFileDialog);
// My Computer or a directory
- QModelIndex sourceIndex = mapToSource(index);
+ QModelIndex sourceIndex = index.model() == proxyModel ? mapToSource(index) : index;
QString path = sourceIndex.data(QFileSystemModel::FilePathRole).toString();
if (path.isEmpty() || model->isDir(sourceIndex)) {
q->setDirectory(path);
diff --git a/src/gui/dialogs/qmessagebox.cpp b/src/gui/dialogs/qmessagebox.cpp
index 456b480..5e59501 100644
--- a/src/gui/dialogs/qmessagebox.cpp
+++ b/src/gui/dialogs/qmessagebox.cpp
@@ -280,6 +280,9 @@ void QMessageBoxPrivate::updateSize()
int hardLimit = screenSize.width() - (q->frameGeometry().width() - q->geometry().width());
#else
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);
diff --git a/src/gui/itemviews/qabstractitemview.cpp b/src/gui/itemviews/qabstractitemview.cpp
index b1aac37..cc14d3e 100644
--- a/src/gui/itemviews/qabstractitemview.cpp
+++ b/src/gui/itemviews/qabstractitemview.cpp
@@ -1380,7 +1380,7 @@ bool QAbstractItemView::event(QEvent *event)
d->executePostedLayout(); //make sure we set the layout properly
break;
case QEvent::Show:
- {
+ if (d->delayedPendingLayout) {
d->executePostedLayout(); //make sure we set the layout properly
const QModelIndex current = currentIndex();
if (current.isValid() && (d->state == QAbstractItemView::EditingState || d->autoScroll))
diff --git a/src/gui/itemviews/qitemselectionmodel.cpp b/src/gui/itemviews/qitemselectionmodel.cpp
index 1a3ae2d..8baefdf 100644
--- a/src/gui/itemviews/qitemselectionmodel.cpp
+++ b/src/gui/itemviews/qitemselectionmodel.cpp
@@ -1313,11 +1313,11 @@ bool QItemSelectionModel::rowIntersectsSelection(int row, const QModelIndex &par
int left = sel.at(i).left();
int right = sel.at(i).right();
if (top <= row && bottom >= row) {
- Qt::ItemFlags leftFlags = d->model->index(row, left, parent).flags();
- Qt::ItemFlags rightFlags = d->model->index(row, right, parent).flags();
- if ((leftFlags & Qt::ItemIsSelectable) && (leftFlags & Qt::ItemIsEnabled)
- && (rightFlags & Qt::ItemIsSelectable) && (rightFlags & Qt::ItemIsEnabled))
- return true;
+ for (int j = left; j <= right; j++) {
+ const Qt::ItemFlags flags = d->model->index(row, j, parent).flags();
+ if ((flags & Qt::ItemIsSelectable) && (flags & Qt::ItemIsEnabled))
+ return true;
+ }
}
}
@@ -1342,11 +1342,11 @@ bool QItemSelectionModel::columnIntersectsSelection(int column, const QModelInde
int top = sel.at(i).top();
int bottom = sel.at(i).bottom();
if (left <= column && right >= column) {
- Qt::ItemFlags topFlags = d->model->index(top, column, parent).flags();
- Qt::ItemFlags bottomFlags = d->model->index(bottom, column, parent).flags();
- if ((topFlags & Qt::ItemIsSelectable) && (topFlags & Qt::ItemIsEnabled)
- && (bottomFlags & Qt::ItemIsSelectable) && (bottomFlags & Qt::ItemIsEnabled))
- return true;
+ for (int j = top; j <= bottom; j++) {
+ const Qt::ItemFlags flags = d->model->index(j, column, parent).flags();
+ if ((flags & Qt::ItemIsSelectable) && (flags & Qt::ItemIsEnabled))
+ return true;
+ }
}
}
diff --git a/src/gui/kernel/qcocoaview_mac.mm b/src/gui/kernel/qcocoaview_mac.mm
index cf66605..60ac062 100644
--- a/src/gui/kernel/qcocoaview_mac.mm
+++ b/src/gui/kernel/qcocoaview_mac.mm
@@ -809,10 +809,10 @@ extern "C" {
QWheelEvent qwe(qlocal, qglobal, deltaY, buttons, keyMods, Qt::Vertical);
qt_sendSpontaneousEvent(qwidget, &qwe);
wheelOK = qwe.isAccepted();
- if (wheelOK && QApplicationPrivate::focus_widget
+ if (!wheelOK && QApplicationPrivate::focus_widget
&& QApplicationPrivate::focus_widget != qwidget) {
QWheelEvent qwe2(QApplicationPrivate::focus_widget->mapFromGlobal(qglobal), qglobal,
- deltaZ, buttons, keyMods, Qt::Vertical);
+ deltaY, buttons, keyMods, Qt::Vertical);
qt_sendSpontaneousEvent(QApplicationPrivate::focus_widget, &qwe2);
wheelOK = qwe2.isAccepted();
}
diff --git a/src/gui/kernel/qcocoawindowdelegate_mac.mm b/src/gui/kernel/qcocoawindowdelegate_mac.mm
index 03b2fce..fa325f4 100644
--- a/src/gui/kernel/qcocoawindowdelegate_mac.mm
+++ b/src/gui/kernel/qcocoawindowdelegate_mac.mm
@@ -194,7 +194,6 @@ static void cleanupCocoaWindowDelegate()
{
NSWindow *window = [notification object];
QWidget *qwidget = m_windowHash->value(window);
- // Just here to handle the is zoomed method.
QWidgetData *widgetData = qt_qwidget_data(qwidget);
if (!(qwidget->windowState() & (Qt::WindowMaximized | Qt::WindowFullScreen)) && [window isZoomed]) {
widgetData->window_state = widgetData->window_state | Qt::WindowMaximized;
@@ -202,7 +201,6 @@ static void cleanupCocoaWindowDelegate()
& ~Qt::WindowMaximized));
qt_sendSpontaneousEvent(qwidget, &e);
}
- [self checkForMove:[window frame] forWidget:qwidget];
NSRect rect = [[window contentView] frame];
const QSize newSize(rect.size.width, rect.size.height);
const QSize &oldSize = widgetData->crect.size();
@@ -212,12 +210,18 @@ static void cleanupCocoaWindowDelegate()
}
}
-- (void)checkForMove:(const NSRect &)newRect forWidget:(QWidget *)qwidget
+- (void)windowDidMove:(NSNotification *)notification
{
- // newRect's origin is bottom left.
+ // The code underneath needs to translate the window location
+ // from bottom left (which is the origin used by Cocoa) to
+ // upper left (which is the origin used by Qt):
+ NSWindow *window = [notification object];
+ NSRect newRect = [window frame];
+ QWidget *qwidget = m_windowHash->value(window);
QPoint qtPoint = flipPoint(NSMakePoint(newRect.origin.x,
newRect.origin.y + newRect.size.height)).toPoint();
const QRect &oldRect = qwidget->frameGeometry();
+
if (qtPoint.x() != oldRect.x() || qtPoint.y() != oldRect.y()) {
QWidgetData *widgetData = qt_qwidget_data(qwidget);
QRect oldCRect = widgetData->crect;
@@ -233,11 +237,6 @@ static void cleanupCocoaWindowDelegate()
}
}
-- (void)windowDidMove:(NSNotification *)notification
-{
- [self windowDidResize:notification];
-}
-
-(BOOL)windowShouldClose:(id)windowThatWantsToClose
{
QWidget *qwidget = m_windowHash->value(windowThatWantsToClose);
diff --git a/src/gui/kernel/qwidget_mac.mm b/src/gui/kernel/qwidget_mac.mm
index 0f74c32..b238279 100644
--- a/src/gui/kernel/qwidget_mac.mm
+++ b/src/gui/kernel/qwidget_mac.mm
@@ -4033,7 +4033,11 @@ void QWidgetPrivate::setGeometry_sys(int x, int y, int w, int h, bool isMove)
QMacCocoaAutoReleasePool pool;
bool realWindow = isRealWindow();
- if (realWindow && !(w == 0 && h == 0) && !q->testAttribute(Qt::WA_DontShowOnScreen)) {
+ if (realWindow && !q->testAttribute(Qt::WA_DontShowOnScreen)
+#ifndef QT_MAC_USE_COCOA
+ && !(w == 0 && h == 0)
+#endif
+ ){
applyMaxAndMinSizeConstraints(w, h);
topData()->isSetGeometry = 1;
topData()->isMove = isMove;
@@ -4048,7 +4052,24 @@ void QWidgetPrivate::setGeometry_sys(int x, int y, int w, int h, bool isMove)
fStrut.top() + fStrut.bottom() + h));
NSRect cocoaFrameRect = NSMakeRect(frameRect.x(), flipYCoordinate(frameRect.bottom() + 1),
frameRect.width(), frameRect.height());
- [window setFrame:cocoaFrameRect display:NO];
+
+ QPoint currTopLeft = data.crect.topLeft();
+ if (currTopLeft.x() == x && currTopLeft.y() == y
+ && cocoaFrameRect.size.width != 0
+ && cocoaFrameRect.size.height != 0) {
+ [window setFrame:cocoaFrameRect display:NO];
+ } else {
+ // The window is moved and resized (or resized to zero).
+ // Since Cocoa usually only sends us a resize callback after
+ // setting a window frame, we issue an explicit move as
+ // well. To stop Cocoa from optimize away the move (since the move
+ // would have the same origin as the setFrame call) we shift the
+ // window back and forth inbetween.
+ cocoaFrameRect.origin.y += 1;
+ [window setFrame:cocoaFrameRect display:NO];
+ cocoaFrameRect.origin.y -= 1;
+ [window setFrameOrigin:cocoaFrameRect.origin];
+ }
#endif
topData()->isSetGeometry = 0;
} else {
diff --git a/src/gui/painting/qpaintengine_x11.cpp b/src/gui/painting/qpaintengine_x11.cpp
index 39ce59f..4b2fbca 100644
--- a/src/gui/painting/qpaintengine_x11.cpp
+++ b/src/gui/painting/qpaintengine_x11.cpp
@@ -2352,7 +2352,9 @@ void QX11PaintEngine::drawFreetype(const QPointF &p, const QTextItemInt &ti)
GlyphSet glyphSet = set->id;
const QColor &pen = d->cpen.color();
::Picture src = X11->getSolidFill(d->scrn, pen);
- XRenderPictFormat *maskFormat = XRenderFindStandardFormat(X11->display, ft->xglyph_format);
+ XRenderPictFormat *maskFormat = 0;
+ if (ft->xglyph_format != PictStandardA1)
+ maskFormat = XRenderFindStandardFormat(X11->display, ft->xglyph_format);
enum { t_min = SHRT_MIN, t_max = SHRT_MAX };