Qt: allow FileDropWidget to be styleable

This commit is contained in:
Brad Parker 2018-07-30 18:22:18 -04:00
parent b5d5fb4940
commit 50381a0463
2 changed files with 14 additions and 0 deletions

View File

@ -217,6 +217,19 @@ FileDropWidget::FileDropWidget(QWidget *parent) :
setAcceptDrops(true);
}
void FileDropWidget::paintEvent(QPaintEvent *event)
{
QStyleOption o;
QPainter p;
o.initFrom(this);
p.begin(this);
style()->drawPrimitive(
QStyle::PE_Widget, &o, &p, this);
p.end();
QWidget::paintEvent(event);
}
void FileDropWidget::keyPressEvent(QKeyEvent *event)
{
if (event->key() == Qt::Key_Delete)

View File

@ -153,6 +153,7 @@ protected:
void dragEnterEvent(QDragEnterEvent *event);
void dropEvent(QDropEvent *event);
void keyPressEvent(QKeyEvent *event);
void paintEvent(QPaintEvent *event);
};
class TableWidget : public QTableWidget