summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPetr Mrázek <peterix@gmail.com>2013-03-19 03:20:49 +0100
committerPetr Mrázek <peterix@gmail.com>2013-03-19 03:20:49 +0100
commitd67d58e662159d53ee5fde37a6f60903f6350731 (patch)
tree926837b53c7bcd74e5ebe3163b02dd3792923a60
parent7e222c3e8f4d1c007edafc31e75e7712813dd64b (diff)
downloadMultiMC-d67d58e662159d53ee5fde37a6f60903f6350731.tar
MultiMC-d67d58e662159d53ee5fde37a6f60903f6350731.tar.gz
MultiMC-d67d58e662159d53ee5fde37a6f60903f6350731.tar.lz
MultiMC-d67d58e662159d53ee5fde37a6f60903f6350731.tar.xz
MultiMC-d67d58e662159d53ee5fde37a6f60903f6350731.zip
Added background cat. Proof of concept :3
-rw-r--r--gui/instancedelegate.cpp12
-rw-r--r--gui/mainwindow.cpp17
-rw-r--r--multimc.qrc3
-rw-r--r--resources/catbgrnd2.pngbin0 -> 78285 bytes
4 files changed, 28 insertions, 4 deletions
diff --git a/gui/instancedelegate.cpp b/gui/instancedelegate.cpp
index dac2dacb..86b7d399 100644
--- a/gui/instancedelegate.cpp
+++ b/gui/instancedelegate.cpp
@@ -33,9 +33,15 @@ ListViewDelegate::ListViewDelegate ( QObject* parent ) : QStyledItemDelegate ( p
void drawSelectionRect(QPainter *painter, const QStyleOptionViewItemV4 &option, const QRect &rect)
{
- if (!(option.state & QStyle::State_Selected))
- return;
- painter->fillRect ( rect, option.palette.brush ( QPalette::Highlight ) );
+ if ((option.state & QStyle::State_Selected))
+ painter->fillRect ( rect, option.palette.brush ( QPalette::Highlight ) );
+ else
+ {
+ QColor backgroundColor = option.palette.color(QPalette::Background);
+ backgroundColor.setAlpha(160);
+ painter->fillRect ( rect, QBrush(backgroundColor) );
+ }
+
}
void drawFocusRect(QPainter *painter, const QStyleOptionViewItemV4 &option, const QRect &rect)
diff --git a/gui/mainwindow.cpp b/gui/mainwindow.cpp
index b799bdcf..a96d80a7 100644
--- a/gui/mainwindow.cpp
+++ b/gui/mainwindow.cpp
@@ -66,7 +66,22 @@ MainWindow::MainWindow ( QWidget *parent ) :
// Create the widget
view = new KCategorizedView ( ui->centralWidget );
drawer = new KCategoryDrawer ( view );
-
+ /*
+ QPalette pal = view->palette();
+ pal.setBrush(QPalette::Base, QBrush(QPixmap(QString::fromUtf8(":/backgrounds/kitteh"))));
+ view->setPalette(pal);
+ */
+ view->setStyleSheet(
+ "QListView\
+ {\
+ background-image: url(:/backgrounds/kitteh);\
+ background-attachment: fixed;\
+ background-clip: padding;\
+ background-position: top right;\
+ background-repeat: none;\
+ background-color:palette(base);\
+ }");
+
view->setSelectionMode ( QAbstractItemView::SingleSelection );
//view->setSpacing( KDialog::spacingHint() );
view->setCategoryDrawer ( drawer );
diff --git a/multimc.qrc b/multimc.qrc
index cfcc9829..acd9efd2 100644
--- a/multimc.qrc
+++ b/multimc.qrc
@@ -34,4 +34,7 @@
<file alias="scalable/apps/multimc.svg">resources/icons/multimc.svg</file>
<file alias="index.theme">resources/XdgIcon.theme</file>
</qresource>
+ <qresource prefix="/backgrounds">
+ <file alias="kitteh">resources/catbgrnd2.png</file>
+ </qresource>
</RCC>
diff --git a/resources/catbgrnd2.png b/resources/catbgrnd2.png
new file mode 100644
index 00000000..2b949e0b
--- /dev/null
+++ b/resources/catbgrnd2.png
Binary files differ