From a3a79fefe65ec12c4c34a69885c2d23d79538a97 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Fri, 4 Mar 2011 10:29:46 +0100 Subject: Fail in a nicer way when QPixmap is used in a non-GUI application. Show same fatal message as when trying to instantiate a QWidget. Task-number: QTBUG-17873 Reviewed-by: Gunnar Sletta --- src/gui/image/qpixmap.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/gui/image/qpixmap.cpp b/src/gui/image/qpixmap.cpp index f896572..71fb079 100644 --- a/src/gui/image/qpixmap.cpp +++ b/src/gui/image/qpixmap.cpp @@ -112,8 +112,13 @@ void QPixmap::init(int w, int h, Type type) init(w, h, int(type)); } +extern QApplication::Type qt_appType; + void QPixmap::init(int w, int h, int type) { + if (qt_appType == QApplication::Tty) + qFatal("QPixmap: Cannot create a QPixmap when no GUI is being used"); + if ((w > 0 && h > 0) || type == QPixmapData::BitmapType) data = QPixmapData::create(w, h, (QPixmapData::PixelType) type); else -- cgit v0.12 From bfcd2cabf7b5bc15105c968f80f71132efb65759 Mon Sep 17 00:00:00 2001 From: Jiang Jiang Date: Thu, 3 Mar 2011 18:39:51 +0100 Subject: Place cursor at the end of the selected range MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Selected range is the range of the text that has been edited with input method, but not yet committed, normally the cursor should be placed that the end of it (or hidden). Task-number: QTBUG-17923 Reviewed-by: Morten Sørvig --- src/gui/kernel/qcocoaview_mac.mm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/kernel/qcocoaview_mac.mm b/src/gui/kernel/qcocoaview_mac.mm index ff2dfe7..5e8b37e 100644 --- a/src/gui/kernel/qcocoaview_mac.mm +++ b/src/gui/kernel/qcocoaview_mac.mm @@ -983,7 +983,7 @@ static int qCocoaViewCount = 0; QString qtText; // Cursor position is retrived from the range. QList attrs; - attrs<([aString string])); composingLength = qtText.length(); -- cgit v0.12