Tests of gui.
This commit is contained in:
parent
161523453f
commit
960e16a79f
3 changed files with 66 additions and 1 deletions
|
@ -63,6 +63,8 @@ FeedsView::FeedsView(QWidget *parent)
|
||||||
|
|
||||||
// Setup the timer.
|
// Setup the timer.
|
||||||
updateAutoUpdateStatus();
|
updateAutoUpdateStatus();
|
||||||
|
|
||||||
|
setItemDelegateForColumn(1, new Delegate(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
FeedsView::~FeedsView() {
|
FeedsView::~FeedsView() {
|
||||||
|
@ -686,3 +688,8 @@ void FeedsView::validateItemAfterDragDrop(const QModelIndex &source_index) {
|
||||||
setCurrentIndex(mapped);
|
setCurrentIndex(mapped);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Delegate::Delegate(QObject *parent) : QStyledItemDelegate(parent) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
#ifndef FEEDSVIEW_H
|
#ifndef FEEDSVIEW_H
|
||||||
#define FEEDSVIEW_H
|
#define FEEDSVIEW_H
|
||||||
|
|
||||||
|
#include <QStyledItemDelegate>
|
||||||
#include <QTreeView>
|
#include <QTreeView>
|
||||||
|
|
||||||
#include "core/messagesmodel.h"
|
#include "core/messagesmodel.h"
|
||||||
|
@ -31,6 +32,63 @@ class FeedsModelFeed;
|
||||||
class FeedsModelCategory;
|
class FeedsModelCategory;
|
||||||
class QTimer;
|
class QTimer;
|
||||||
|
|
||||||
|
#include <QPainter>
|
||||||
|
|
||||||
|
class Delegate : public QStyledItemDelegate {
|
||||||
|
public:
|
||||||
|
explicit Delegate(QObject *parent = 0);
|
||||||
|
|
||||||
|
// QAbstractItemDelegate interface
|
||||||
|
public:
|
||||||
|
void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const
|
||||||
|
{
|
||||||
|
QSize size = sizeHint(option, index);
|
||||||
|
|
||||||
|
int left = option.rect.left() + ((option.rect.width() - size.width()) / 2.0) - 1;
|
||||||
|
int top = option.rect.top() + ((option.rect.height() - size.height()) / 2.0) + 2;
|
||||||
|
int width = size.width() + 2;
|
||||||
|
int height = size.height() - 2;
|
||||||
|
|
||||||
|
painter->save();
|
||||||
|
|
||||||
|
//if ((option.state & QStyle::State_MouseOver) == 0 && (option.state & QStyle::State_Selected) == 0) {
|
||||||
|
painter->setPen(QPen(QColor(Qt::black)));
|
||||||
|
painter->setRenderHint(QPainter::Antialiasing, false);
|
||||||
|
painter->setBrush(QBrush(Qt::lightGray));
|
||||||
|
/*painter->drawRoundRect(QRect(left,
|
||||||
|
top,
|
||||||
|
width,
|
||||||
|
height), 15, 15);*/
|
||||||
|
//}
|
||||||
|
|
||||||
|
painter->drawRect(QRect(left,
|
||||||
|
top,
|
||||||
|
width,
|
||||||
|
height));
|
||||||
|
|
||||||
|
painter->restore();
|
||||||
|
|
||||||
|
|
||||||
|
QStyledItemDelegate::paint(painter, option, index);
|
||||||
|
}
|
||||||
|
|
||||||
|
// QStyledItemDelegate interface
|
||||||
|
public:
|
||||||
|
QString displayText(const QVariant &value, const QLocale &locale) const
|
||||||
|
{
|
||||||
|
return value.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
// QAbstractItemDelegate interface
|
||||||
|
public:
|
||||||
|
QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const
|
||||||
|
{
|
||||||
|
QSize base_size = QStyledItemDelegate::sizeHint(option, index);
|
||||||
|
|
||||||
|
return base_size;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
class FeedsView : public QTreeView {
|
class FeedsView : public QTreeView {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
|
|
|
@ -115,7 +115,7 @@ int main(int argc, char *argv[]) {
|
||||||
qApp->showTrayIcon();
|
qApp->showTrayIcon();
|
||||||
|
|
||||||
if (qApp->settings()->value(GROUP(General), SETTING(General::UpdateOnStartup)).toBool()) {
|
if (qApp->settings()->value(GROUP(General), SETTING(General::UpdateOnStartup)).toBool()) {
|
||||||
QTimer::singleShot(STARTUP_UPDATE_DELAY, application.system(), SLOT(checkForUpdatesAsynchronously()));
|
QTimer::singleShot(STARTUP_UPDATE_DELAY, application.system(), SLOT(checkForUpdatesOnStartup()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue