summaryrefslogtreecommitdiffstats
path: root/src/widgets/dialogs
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2016-05-19 11:04:19 +0200
committerLiang Qi <liang.qi@qt.io>2016-05-19 12:55:27 +0200
commit818014b449ef996099b4795a82f09651cf1c0129 (patch)
tree02f991007097fa368491a81eebbabe4cc162a0e0 /src/widgets/dialogs
parente6cc1d788dddda2998a9f941664ede928ce1e212 (diff)
parent640441882d20f86db05ab5fd1141abe39a0bd409 (diff)
Merge remote-tracking branch 'origin/5.6' into 5.7
Conflicts: configure src/3rdparty/angle/src/libANGLE/renderer/d3d/d3d11/Renderer11.cpp src/network/access/qnetworkaccessmanager.cpp src/plugins/platforms/cocoa/qcocoacolordialoghelper.mm src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmcursor.cpp src/plugins/platforms/eglfs/deviceintegration/eglfs_kms/qeglfskmsgbmcursor.h src/widgets/widgets/qlineedit_p.cpp src/widgets/widgets/qlineedit_p.h src/winmain/winmain.pro tests/auto/corelib/io/qstorageinfo/tst_qstorageinfo.cpp tests/auto/dbus/qdbusconnection/tst_qdbusconnection.cpp tests/auto/dbus/qdbusconnection/tst_qdbusconnection.h tests/auto/testlib/selftests/expected_cmptest.teamcity tests/auto/testlib/selftests/expected_cmptest.txt tests/auto/widgets/itemviews/qtableview/tst_qtableview.cpp tools/configure/configureapp.cpp Change-Id: Ib9997b0d0f91946e4081d36c0c6b696c5c983b2a
Diffstat (limited to 'src/widgets/dialogs')
-rw-r--r--src/widgets/dialogs/qcolordialog.cpp35
-rw-r--r--src/widgets/dialogs/qfilesystemmodel.cpp21
2 files changed, 21 insertions, 35 deletions
diff --git a/src/widgets/dialogs/qcolordialog.cpp b/src/widgets/dialogs/qcolordialog.cpp
index 98f1f4870d..04ef82f49d 100644
--- a/src/widgets/dialogs/qcolordialog.cpp
+++ b/src/widgets/dialogs/qcolordialog.cpp
@@ -174,8 +174,6 @@ private:
namespace {
-struct QWellArrayData;
-
class QWellArray : public QWidget
{
Q_OBJECT
@@ -195,8 +193,6 @@ public:
QSize sizeHint() const Q_DECL_OVERRIDE;
- virtual void setCellBrush(int row, int col, const QBrush &);
-
inline int cellWidth() const
{ return cellw; }
@@ -263,7 +259,6 @@ private:
int curCol;
int selRow;
int selCol;
- QWellArrayData *d;
};
void QWellArray::paintEvent(QPaintEvent *e)
@@ -313,15 +308,10 @@ void QWellArray::paintEvent(QPaintEvent *e)
}
}
-struct QWellArrayData {
- QBrush *brush;
-};
-
QWellArray::QWellArray(int rows, int cols, QWidget *parent)
: QWidget(parent)
,nrows(rows), ncols(cols)
{
- d = 0;
setFocusPolicy(Qt::StrongFocus);
cellw = 28;
cellh = 24;
@@ -370,14 +360,12 @@ void QWellArray::paintCell(QPainter* p, int row, int col, const QRect &rect)
*/
void QWellArray::paintCellContents(QPainter *p, int row, int col, const QRect &r)
{
- if (d) {
- p->fillRect(r, d->brush[row*numCols()+col]);
- } else {
- p->fillRect(r, Qt::white);
- p->setPen(Qt::black);
- p->drawLine(r.topLeft(), r.bottomRight());
- p->drawLine(r.topRight(), r.bottomLeft());
- }
+ Q_UNUSED(row);
+ Q_UNUSED(col);
+ p->fillRect(r, Qt::white);
+ p->setPen(Qt::black);
+ p->drawLine(r.topLeft(), r.bottomRight());
+ p->drawLine(r.topRight(), r.bottomLeft());
}
void QWellArray::mousePressEvent(QMouseEvent *e)
@@ -453,17 +441,6 @@ void QWellArray::focusInEvent(QFocusEvent*)
emit currentChanged(curRow, curCol);
}
-void QWellArray::setCellBrush(int row, int col, const QBrush &b)
-{
- if (!d) {
- d = new QWellArrayData;
- int i = numRows()*numCols();
- d->brush = new QBrush[i];
- }
- if (row >= 0 && row < numRows() && col >= 0 && col < numCols())
- d->brush[row*numCols()+col] = b;
-}
-
/*!\reimp
*/
diff --git a/src/widgets/dialogs/qfilesystemmodel.cpp b/src/widgets/dialogs/qfilesystemmodel.cpp
index f639be809c..81c8fbe229 100644
--- a/src/widgets/dialogs/qfilesystemmodel.cpp
+++ b/src/widgets/dialogs/qfilesystemmodel.cpp
@@ -372,6 +372,9 @@ QFileSystemModelPrivate::QFileSystemNode *QFileSystemModelPrivate::node(const QS
)
return const_cast<QFileSystemModelPrivate::QFileSystemNode*>(&root);
QModelIndex index = QModelIndex(); // start with "My Computer"
+ QString elementPath;
+ QChar separator = QLatin1Char('/');
+ QString trailingSeparator;
#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
if (absolutePath.startsWith(QLatin1String("//"))) { // UNC path
QString host = QLatin1String("\\\\") + pathElements.constFirst();
@@ -379,6 +382,8 @@ QFileSystemModelPrivate::QFileSystemNode *QFileSystemModelPrivate::node(const QS
absolutePath.append(QLatin1Char('/'));
if (longPath.endsWith(QLatin1Char('/')) && !absolutePath.endsWith(QLatin1Char('/')))
absolutePath.append(QLatin1Char('/'));
+ if (absolutePath.endsWith(QLatin1Char('/')))
+ trailingSeparator = QLatin1String("\\");
int r = 0;
QFileSystemModelPrivate::QFileSystemNode *rootNode = const_cast<QFileSystemModelPrivate::QFileSystemNode*>(&root);
if (!root.children.contains(host.toLower())) {
@@ -395,11 +400,10 @@ QFileSystemModelPrivate::QFileSystemNode *QFileSystemModelPrivate::node(const QS
r = translateVisibleLocation(rootNode, r);
index = q->index(r, 0, QModelIndex());
pathElements.pop_front();
- } else
-#endif
-
-#if defined(Q_OS_WIN) && !defined(Q_OS_WINCE)
- {
+ separator = QLatin1Char('\\');
+ elementPath = host;
+ elementPath.append(separator);
+ } else {
if (!pathElements.at(0).contains(QLatin1Char(':'))) {
QString rootPath = QDir(longPath).rootPath();
pathElements.prepend(rootPath);
@@ -417,6 +421,11 @@ QFileSystemModelPrivate::QFileSystemNode *QFileSystemModelPrivate::node(const QS
for (int i = 0; i < pathElements.count(); ++i) {
QString element = pathElements.at(i);
+ if (i != 0)
+ elementPath.append(separator);
+ elementPath.append(element);
+ if (i == pathElements.count() - 1)
+ elementPath.append(trailingSeparator);
#ifdef Q_OS_WIN
// On Windows, "filename " and "filename" are equivalent and
// "filename . " and "filename" are equivalent
@@ -448,7 +457,7 @@ QFileSystemModelPrivate::QFileSystemNode *QFileSystemModelPrivate::node(const QS
if (!alreadyExisted) {
// Someone might call ::index("file://cookie/monster/doesn't/like/veggies"),
// a path that doesn't exists, I.E. don't blindly create directories.
- QFileInfo info(absolutePath);
+ QFileInfo info(elementPath);
if (!info.exists())
return const_cast<QFileSystemModelPrivate::QFileSystemNode*>(&root);
QFileSystemModelPrivate *p = const_cast<QFileSystemModelPrivate*>(this);