[rkward/frameworks] rkward: Assorted KF5 porting

Thomas Friedrichsmeier thomas.friedrichsmeier at ruhr-uni-bochum.de
Tue Jun 9 11:26:18 UTC 2015


Git commit fbc0c894a9b0d617b0b094e9cc0919eff4b7aa2c by Thomas Friedrichsmeier.
Committed on 03/06/2015 at 12:52.
Pushed by tfry into branch 'frameworks'.

Assorted KF5 porting

M  +7    -7    rkward/dataeditor/rkvareditmodel.cpp
M  +1    -0    rkward/settings/CMakeLists.txt
M  +3    -2    rkward/settings/rksettings.cpp

http://commits.kde.org/rkward/fbc0c894a9b0d617b0b094e9cc0919eff4b7aa2c

diff --git a/rkward/dataeditor/rkvareditmodel.cpp b/rkward/dataeditor/rkvareditmodel.cpp
index 974cf6f..6ca1efd 100644
--- a/rkward/dataeditor/rkvareditmodel.cpp
+++ b/rkward/dataeditor/rkvareditmodel.cpp
@@ -281,12 +281,12 @@ QVariant RKVarEditModel::data (const QModelIndex& index, int role) const {
 
 	if (col < var_col_offset) {
 		// TODO: make this look more like a normal header
-		if (role == Qt::ForegroundRole) return (Qt::blue);
+		if (role == Qt::ForegroundRole) return (QColor (Qt::blue));
 	}
 
 	// on a trailing row / col
 	if ((col >= objects.size ()) || (row >= objects[0]->getLength ())) {
-		if (role == Qt::BackgroundRole) return (Qt::gray);
+		if (role == Qt::BackgroundRole) return (QColor (Qt::gray));
 		if (role == Qt::ToolTipRole) {
 			if (col >= objects.size ()) return (i18n ("Type on these fields to add new columns"));
 			else return (i18n ("Type on these fields to add new rows"));
@@ -306,11 +306,11 @@ QVariant RKVarEditModel::data (const QModelIndex& index, int role) const {
 		return var->getText (row, true);
 	}
 	if (role == Qt::BackgroundRole) {
-		if (status == RKVariable::ValueInvalid) return (Qt::red);
+		if (status == RKVariable::ValueInvalid) return (QColor (Qt::red));
 	} else if (role == Qt::ToolTipRole) {
 		if (status == RKVariable::ValueInvalid) return (i18n ("This value is not allowed, here"));
 	}
-	if ((role == Qt::ForegroundRole) && ((status == RKVariable::ValueUnknown) || (status == RKVariable::ValueUnused))) return (Qt::lightGray);
+	if ((role == Qt::ForegroundRole) && ((status == RKVariable::ValueUnknown) || (status == RKVariable::ValueUnused))) return (QColor (Qt::lightGray));
 	if (role == Qt::TextAlignmentRole) {
 		if (var->getAlignment () == RKVariable::AlignCellLeft) return ((int) Qt::AlignLeft | Qt::AlignVCenter);
 		else return ((int) Qt::AlignRight | Qt::AlignVCenter);
@@ -380,7 +380,7 @@ QVariant RKVarEditModel::headerData (int section, Qt::Orientation orientation, i
 			if (section < var_col_offset) return i18n ("Row names");
 			return (QString::number (section - var_col_offset + 1));
 		} else if (role == Qt::BackgroundRole) {
-			if ((section < objects.size  ()) && objects[section]->hasInvalidFields ()) return QVariant (Qt::red);
+			if ((section < objects.size  ()) && objects[section]->hasInvalidFields ()) return QVariant (QColor (Qt::red));
 		} else if ((role == Qt::ToolTipRole) || (role == Qt::StatusTipRole)) {
 			if ((section < objects.size  ()) && objects[section]->hasInvalidFields ()) return i18n ("This column contains one or more invalid fields");
 		}
@@ -549,13 +549,13 @@ QVariant RKVarEditMetaModel::data (const QModelIndex& index, int role) const {
 	}
 
 	if (col < var_col_offset) {
-	  	if (role == Qt::BackgroundRole) return (Qt::lightGray);
+		if (role == Qt::BackgroundRole) return (QColor (Qt::lightGray));
 		return QVariant ();
 	}
 
 	// on a trailing col
 	if (col >= data_model->objects.size ()) {
-		if (role == Qt::BackgroundRole) return (Qt::gray);
+		if (role == Qt::BackgroundRole) return (QColor (Qt::gray));
 		if (role == Qt::ToolTipRole) return (i18n ("Type on these fields to add new columns"));
 		return QVariant ();
 	}
diff --git a/rkward/settings/CMakeLists.txt b/rkward/settings/CMakeLists.txt
index f187dcc..f587a68 100644
--- a/rkward/settings/CMakeLists.txt
+++ b/rkward/settings/CMakeLists.txt
@@ -28,3 +28,4 @@ IF (WIN32 OR USE_BINARY_PACKAGES)
 ENDIF (WIN32 OR USE_BINARY_PACKAGES)
 
 ADD_LIBRARY(settings STATIC ${settings_STAT_SRCS})
+TARGET_LINK_LIBRARIES(settings Qt5::Widgets KF5::KDELibs4Support)
\ No newline at end of file
diff --git a/rkward/settings/rksettings.cpp b/rkward/settings/rksettings.cpp
index fb39115..2cc4f3d 100644
--- a/rkward/settings/rksettings.cpp
+++ b/rkward/settings/rksettings.cpp
@@ -68,8 +68,9 @@ RKSettings::RKSettings (QWidget *parent) : KPageDialog (parent) {
 	RK_TRACE (SETTINGS);
 
 	setFaceType (KPageDialog::Tree);
-	setCaption (i18n ("Settings"));
-	setButtons (KDialog::Ok | KDialog::Apply | KDialog::Cancel | KDialog::Help);
+	setWindowTitle (i18n ("Settings"));
+	buttonBox ()->setStandardButtons (QDialogButtonBox::Ok | QDialogButtonBox::Apply | QDialogButtonBox::Cancel | QDialogButtonBox::Help);
+	// KF5 TODO: connect buttons
 	enableButtonApply (false);
 
 	setAttribute (Qt::WA_DeleteOnClose, true);



More information about the rkward-tracker mailing list