zz_colorSelectDialog.cpp

changeset 58
4db04d4857c0
parent 49
242f6ea0f5e5
child 68
c637b172d565
--- a/zz_colorSelectDialog.cpp	Thu Mar 21 03:20:02 2013 +0200
+++ b/zz_colorSelectDialog.cpp	Thu Mar 21 12:57:06 2013 +0200
@@ -24,6 +24,7 @@
 #include <qboxlayout.h>
 #include <qgraphicsitem.h>
 #include <qevent.h>
+#include <qscrollbar.h>
 #include "zz_colorSelectDialog.h"
 #include "colors.h"
 
@@ -58,6 +59,13 @@
 	qView->setMinimumWidth (lWidth);
 	qView->setMaximumHeight (g_lHeight);
 	qView->setMinimumHeight (g_lHeight);
+	qView->setHorizontalScrollBarPolicy (Qt::ScrollBarAlwaysOff);
+	
+	// If we have a default color selected, scroll down so that it is visible.
+	if (dDefault >= ((g_dNumColumns * g_dNumRows) - 2)) {
+		ulong ulNewY = ((dDefault / g_dNumColumns) - 3) * g_dSquareSize;
+		qView->verticalScrollBar ()->setSliderPosition (ulNewY);
+	}
 	
 	qColorInfo = new QLabel;
 	drawColorInfo ();

mercurial