mirror of
https://github.com/libretro/RetroArch
synced 2025-02-19 12:41:00 +00:00
Qt: draw border around selected grid item
This commit is contained in:
parent
d17c17085c
commit
f0b0be898a
@ -9,6 +9,9 @@ static const QString qt_theme_default_stylesheet = QStringLiteral(""
|
||||
" background-color: transparent;\n"
|
||||
" border: 1px solid #ddd;\n"
|
||||
"}\n"
|
||||
"ThumbnailWidget, ThumbnailLabel, QLabel#thumbnailQLabel {\n"
|
||||
" background-color:#555555;\n"
|
||||
"}\n"
|
||||
);
|
||||
|
||||
static const QString qt_theme_dark_stylesheet = QStringLiteral(""
|
||||
@ -386,4 +389,7 @@ static const QString qt_theme_dark_stylesheet = QStringLiteral(""
|
||||
"QSizeGrip {\n"
|
||||
" background-color:solid;\n"
|
||||
"}\n"
|
||||
"ThumbnailWidget, ThumbnailLabel, QLabel#thumbnailQLabel {\n"
|
||||
" background-color:#555555;\n"
|
||||
"}\n"
|
||||
);
|
||||
|
@ -541,6 +541,7 @@ MainWindow::MainWindow(QWidget *parent) :
|
||||
,m_gridProgressWidget(NULL)
|
||||
,m_currentGridHash()
|
||||
,m_lastViewType(m_viewType)
|
||||
,m_currentGridWidget(NULL)
|
||||
{
|
||||
settings_t *settings = config_get_ptr();
|
||||
QDir playlistDir(settings->paths.directory_playlist);
|
||||
@ -791,8 +792,18 @@ void MainWindow::onGridItemClicked()
|
||||
if (!w)
|
||||
return;
|
||||
|
||||
hash = w->property("hash").value<QHash<QString, QString> >();
|
||||
if (m_currentGridWidget)
|
||||
{
|
||||
m_currentGridWidget->setObjectName("thumbnailWidget");
|
||||
m_currentGridWidget->setFrameStyle(QFrame::Plain);
|
||||
}
|
||||
|
||||
hash = w->property("hash").value<QHash<QString, QString> >();
|
||||
w->setObjectName("thumbnailWidgetSelected");
|
||||
w->setFrameStyle(QFrame::Box | QFrame::Plain);
|
||||
w->setLineWidth(2);
|
||||
|
||||
m_currentGridWidget = w;
|
||||
m_currentGridHash = hash;
|
||||
|
||||
currentItemChanged(hash);
|
||||
@ -3239,9 +3250,10 @@ void MainWindow::addPlaylistHashToGrid(const QVector<QHash<QString, QString> > &
|
||||
item->widget->setSizeHint(thumbnailWidgetSizeHint);
|
||||
item->widget->setFixedSize(item->widget->sizeHint());
|
||||
item->widget->setLayout(new QVBoxLayout());
|
||||
item->widget->setStyleSheet("background-color: #555555");
|
||||
|
||||
item->widget->setObjectName("thumbnailWidget");
|
||||
item->widget->setProperty("hash", QVariant::fromValue<QHash<QString, QString> >(hash));
|
||||
item->widget->setFrameStyle(QFrame::Plain);
|
||||
item->widget->setLineWidth(0);
|
||||
|
||||
connect(item->widget, SIGNAL(mouseDoubleClicked()), this, SLOT(onGridItemDoubleClicked()));
|
||||
connect(item->widget, SIGNAL(mousePressed()), this, SLOT(onGridItemClicked()));
|
||||
@ -3255,6 +3267,7 @@ void MainWindow::addPlaylistHashToGrid(const QVector<QHash<QString, QString> > &
|
||||
item->widget->layout()->addWidget(label);
|
||||
|
||||
newLabel = new QLabel(hash.value("label"), item->widget);
|
||||
newLabel->setObjectName("thumbnailQLabel");
|
||||
newLabel->setAlignment(Qt::AlignCenter);
|
||||
|
||||
item->widget->layout()->addWidget(newLabel);
|
||||
@ -3293,6 +3306,15 @@ void MainWindow::initContentGridLayout()
|
||||
|
||||
m_currentGridHash.clear();
|
||||
|
||||
if (m_currentGridWidget)
|
||||
{
|
||||
m_currentGridWidget->setObjectName("thumbnailWidget");
|
||||
m_currentGridWidget->setFrameStyle(QFrame::Plain);
|
||||
m_currentGridWidget->setLineWidth(0);
|
||||
}
|
||||
|
||||
m_currentGridWidget = NULL;
|
||||
|
||||
path = item->data(Qt::UserRole).toString();
|
||||
|
||||
if (path == ALL_PLAYLISTS_TOKEN)
|
||||
@ -3337,6 +3359,15 @@ void MainWindow::initContentTableWidget()
|
||||
|
||||
m_currentGridHash.clear();
|
||||
|
||||
if (m_currentGridWidget)
|
||||
{
|
||||
m_currentGridWidget->setObjectName("thumbnailWidget");
|
||||
m_currentGridWidget->setFrameStyle(QFrame::Plain);
|
||||
m_currentGridWidget->setLineWidth(0);
|
||||
}
|
||||
|
||||
m_currentGridWidget = NULL;
|
||||
|
||||
horizontal_header_labels << msg_hash_to_str(MENU_ENUM_LABEL_VALUE_QT_NAME);
|
||||
|
||||
m_tableWidget->clear();
|
||||
|
@ -56,7 +56,7 @@ typedef struct ui_companion_qt
|
||||
} ui_companion_qt_t;
|
||||
|
||||
ThumbnailWidget::ThumbnailWidget(QWidget *parent) :
|
||||
QWidget(parent)
|
||||
QFrame(parent)
|
||||
,m_sizeHint(QSize(256, 256))
|
||||
{
|
||||
}
|
||||
@ -85,7 +85,7 @@ void ThumbnailWidget::paintEvent(QPaintEvent *event)
|
||||
QStyle::PE_Widget, &o, &p, this);
|
||||
p.end();
|
||||
|
||||
QWidget::paintEvent(event);
|
||||
QFrame::paintEvent(event);
|
||||
}
|
||||
|
||||
void ThumbnailWidget::resizeEvent(QResizeEvent *event)
|
||||
|
@ -22,6 +22,7 @@
|
||||
#include <QMainWindow>
|
||||
#include <QTreeView>
|
||||
#include <QTableWidget>
|
||||
#include <QFrame>
|
||||
#include <QWidget>
|
||||
#include <QDialog>
|
||||
#include <QLabel>
|
||||
@ -81,11 +82,13 @@ public:
|
||||
QFutureWatcher<GridItem*> imageWatcher;
|
||||
};
|
||||
|
||||
class ThumbnailWidget : public QWidget
|
||||
class ThumbnailWidget : public QFrame
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
ThumbnailWidget(QWidget *parent = 0);
|
||||
ThumbnailWidget(const ThumbnailWidget& other) { assert(false && "DONT EVER USE THIS"); }
|
||||
|
||||
QSize sizeHint() const;
|
||||
void setSizeHint(QSize size);
|
||||
signals:
|
||||
@ -419,12 +422,14 @@ private:
|
||||
QWidget *m_gridProgressWidget;
|
||||
QHash<QString, QString> m_currentGridHash;
|
||||
ViewType m_lastViewType;
|
||||
QPointer<ThumbnailWidget> m_currentGridWidget;
|
||||
|
||||
protected:
|
||||
void closeEvent(QCloseEvent *event);
|
||||
void keyPressEvent(QKeyEvent *event);
|
||||
};
|
||||
|
||||
Q_DECLARE_METATYPE(ThumbnailWidget)
|
||||
Q_DECLARE_METATYPE(QPointer<ThumbnailWidget>)
|
||||
|
||||
RETRO_BEGIN_DECLS
|
||||
|
Loading…
x
Reference in New Issue
Block a user