mirror of
https://github.com/YACReader/yacreader
synced 2025-06-04 01:28:55 -04:00
movido el c?digo de personalizaci?n de qtableview a una nueva clase
corregido sizeHint en YACReaderDeletingProgress
This commit is contained in:
parent
210c48aa58
commit
a8e6a5e718
@ -44,6 +44,7 @@
|
|||||||
#include "server_config_dialog.h"
|
#include "server_config_dialog.h"
|
||||||
#include "tablemodel.h"
|
#include "tablemodel.h"
|
||||||
#include "yacreader_tool_bar_stretch.h"
|
#include "yacreader_tool_bar_stretch.h"
|
||||||
|
#include "yacreader_table_view.h"
|
||||||
|
|
||||||
#include "yacreader_dark_menu.h"
|
#include "yacreader_dark_menu.h"
|
||||||
#include "yacreader_titled_toolbar.h"
|
#include "yacreader_titled_toolbar.h"
|
||||||
@ -150,7 +151,7 @@ void LibraryWindow::doLayout()
|
|||||||
//-------------------------------------------------------------------------
|
//-------------------------------------------------------------------------
|
||||||
|
|
||||||
//CONFIG TREE/TABLE VIEWS--------------------------------------------------
|
//CONFIG TREE/TABLE VIEWS--------------------------------------------------
|
||||||
comicView = new QTableView;
|
comicView = new YACReaderTableView;
|
||||||
foldersView = new QTreeView;
|
foldersView = new QTreeView;
|
||||||
//-------------------------------------------------------------------------
|
//-------------------------------------------------------------------------
|
||||||
|
|
||||||
@ -166,44 +167,7 @@ void LibraryWindow::doLayout()
|
|||||||
foldersView->setUniformRowHeights(true);
|
foldersView->setUniformRowHeights(true);
|
||||||
foldersView->setSelectionBehavior(QAbstractItemView::SelectRows);
|
foldersView->setSelectionBehavior(QAbstractItemView::SelectRows);
|
||||||
|
|
||||||
comicView->setAlternatingRowColors(true);
|
|
||||||
comicView->verticalHeader()->setAlternatingRowColors(true);
|
|
||||||
comicView->setStyleSheet("QTableView {alternate-background-color: #F2F2F2;background-color: #FAFAFA; outline: 0px;}"
|
|
||||||
"QTableCornerButton::section {background-color:#F5F5F5; border:none; border-bottom:1px solid #B8BDC4; border-right:1px solid qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #D1D1D1, stop: 1 #B8BDC4);}"
|
|
||||||
"QTableView::item {outline: 0px; border-bottom: 1px solid #DFDFDF;border-top: 1px solid #FEFEFE; padding-bottom:1px; color:#252626;}"
|
|
||||||
"QTableView::item:selected {outline: 0px; border-bottom: 1px solid #7A8080;border-top: 1px solid #7A8080; padding-bottom:1px; background-color: #7A8080; color: #FFFFFF; }"
|
|
||||||
"QHeaderView::section:horizontal {background-color:#F5F5F5; border-bottom:1px solid #B8BDC4; border-right:1px solid qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #D1D1D1, stop: 1 #B8BDC4); border-left:none; border-top:none; padding:4px; color:#313232;}"
|
|
||||||
"QHeaderView::section:vertical {border-bottom: 1px solid #DFDFDF;border-top: 1px solid #FEFEFE;}"
|
|
||||||
//"QTableView::item:hover {border-bottom: 1px solid #A3A3A3;border-top: 1px solid #A3A3A3; padding-bottom:1px; background-color: #A3A3A3; color: #FFFFFF; }"
|
|
||||||
"");
|
|
||||||
//comicView->setItemDelegate(new YACReaderComicViewDelegate());
|
|
||||||
comicView->setContextMenuPolicy(Qt::ActionsContextMenu);
|
|
||||||
|
|
||||||
comicView->setShowGrid(false);
|
|
||||||
|
|
||||||
comicView->verticalHeader()->setResizeMode(QHeaderView::Fixed);
|
|
||||||
|
|
||||||
//comicView->horizontalHeader()->setResizeMode(QHeaderView::ResizeToContents);
|
|
||||||
comicView->horizontalHeader()->setStretchLastSection(true);
|
|
||||||
comicView->horizontalHeader()->setClickable(false);
|
|
||||||
//comicView->verticalHeader()->setResizeMode(QHeaderView::ResizeToContents);
|
|
||||||
comicView->verticalHeader()->setDefaultSectionSize(24);
|
|
||||||
comicView->verticalHeader()->setClickable(false); //TODO comportamiento anómalo
|
|
||||||
comicView->setCornerButtonEnabled(false);
|
|
||||||
//qApp->setStyleSheet ( qApp->styleSheet() +" QTableView::item{border-right-style:solid;border-width:1;border-color: #d7d7c7;} QTableView::item:selected{background-color: #d7d7c7; color:#000000; border-right-style:solid;border-width:1;border-color: #8c8590;}");
|
|
||||||
//qApp->setStyleSheet ( qApp->styleSheet() +" QTableView {selection-background-color: #d7d7c7; selection-color: #000000;}" );
|
|
||||||
|
|
||||||
/*comicView->setStyleSheet("QTableView {selection-background-color: #d7d7c7; selection-color: #000000; selection-border: 1px solid;}\n QTableView::item{"
|
|
||||||
"border-right-style:solid;"
|
|
||||||
"border-width:1;"
|
|
||||||
"border-color: #DEDEDE;"
|
|
||||||
"}");*/
|
|
||||||
// comicView->verticalHeader()->setStyleSheet("QHeaderView::section"
|
|
||||||
//"{"
|
|
||||||
// "background-color: white /* steelblue */"
|
|
||||||
//"}");
|
|
||||||
comicView->setSelectionBehavior(QAbstractItemView::SelectRows);
|
|
||||||
comicView->setSelectionMode(QAbstractItemView::ExtendedSelection);
|
|
||||||
//-------------------------------------------------------------------------
|
//-------------------------------------------------------------------------
|
||||||
|
|
||||||
//CONFIG NAVEGACIÓN/BÚSQUEDA-----------------------------------------------
|
//CONFIG NAVEGACIÓN/BÚSQUEDA-----------------------------------------------
|
||||||
|
@ -6,7 +6,6 @@
|
|||||||
#include <QModelIndex>
|
#include <QModelIndex>
|
||||||
#include <QFileInfo>
|
#include <QFileInfo>
|
||||||
|
|
||||||
class QTableView;
|
|
||||||
class QTreeView;
|
class QTreeView;
|
||||||
class QDirModel;
|
class QDirModel;
|
||||||
class QAction;
|
class QAction;
|
||||||
@ -44,6 +43,7 @@ class QCloseEvent;
|
|||||||
class ImportWidget;
|
class ImportWidget;
|
||||||
class QSettings;
|
class QSettings;
|
||||||
class LibraryItem;
|
class LibraryItem;
|
||||||
|
class YACReaderTableView;
|
||||||
#include "comic_db.h"
|
#include "comic_db.h"
|
||||||
|
|
||||||
class LibraryWindow : public QMainWindow
|
class LibraryWindow : public QMainWindow
|
||||||
@ -83,7 +83,7 @@ private:
|
|||||||
QCheckBox * includeComicsCheckBox;
|
QCheckBox * includeComicsCheckBox;
|
||||||
//-------------
|
//-------------
|
||||||
QWidget *comics;
|
QWidget *comics;
|
||||||
QTableView * comicView;
|
YACReaderTableView * comicView;
|
||||||
QTreeView * foldersView;
|
QTreeView * foldersView;
|
||||||
QComboBox * selectedLibrary;
|
QComboBox * selectedLibrary;
|
||||||
TreeModel * dm;
|
TreeModel * dm;
|
||||||
|
@ -13,7 +13,8 @@ HEADERS += $$PWD/help_about_dialog.h \
|
|||||||
$$PWD/yacreader_tool_bar_stretch.h \
|
$$PWD/yacreader_tool_bar_stretch.h \
|
||||||
$$PWD/yacreader_dark_menu.h \
|
$$PWD/yacreader_dark_menu.h \
|
||||||
$$PWD/yacreader_titled_toolbar.h \
|
$$PWD/yacreader_titled_toolbar.h \
|
||||||
$$PWD/yacreader_deleting_progress.h
|
$$PWD/yacreader_deleting_progress.h \
|
||||||
|
$$PWD/yacreader_table_view.h
|
||||||
|
|
||||||
SOURCES += $$PWD/help_about_dialog.cpp \
|
SOURCES += $$PWD/help_about_dialog.cpp \
|
||||||
$$PWD/yacreader_field_edit.cpp \
|
$$PWD/yacreader_field_edit.cpp \
|
||||||
@ -27,4 +28,5 @@ SOURCES += $$PWD/help_about_dialog.cpp \
|
|||||||
$$PWD/yacreader_tool_bar_stretch.cpp \
|
$$PWD/yacreader_tool_bar_stretch.cpp \
|
||||||
$$PWD/yacreader_dark_menu.cpp \
|
$$PWD/yacreader_dark_menu.cpp \
|
||||||
$$PWD/yacreader_titled_toolbar.cpp \
|
$$PWD/yacreader_titled_toolbar.cpp \
|
||||||
$$PWD/yacreader_deleting_progress.cpp
|
$$PWD/yacreader_deleting_progress.cpp \
|
||||||
|
$$PWD/yacreader_table_view.cpp
|
@ -17,9 +17,9 @@ YACReaderDeletingProgress::YACReaderDeletingProgress(QWidget *parent) :
|
|||||||
iconLabel->setPixmap(icon);
|
iconLabel->setPixmap(icon);
|
||||||
iconLabel->setStyleSheet(tr("QLabel {padding:0px; margin:0px;}"));
|
iconLabel->setStyleSheet(tr("QLabel {padding:0px; margin:0px;}"));
|
||||||
|
|
||||||
QLabel * title = new QLabel(tr("Please wait, deleting in progress..."));
|
textMessage = new QLabel(tr("Please wait, deleting in progress..."));
|
||||||
|
|
||||||
title->setStyleSheet(tr("QLabel {color:#ABABAB; padding:0 0 0 0px; margin:0px; font-size:18px; font-weight:bold;}"));
|
textMessage->setStyleSheet(tr("QLabel {color:#ABABAB; padding:0 0 0 0px; margin:0px; font-size:18px; font-weight:bold;}"));
|
||||||
|
|
||||||
QProgressBar * progressBar = new QProgressBar();
|
QProgressBar * progressBar = new QProgressBar();
|
||||||
|
|
||||||
@ -39,7 +39,7 @@ YACReaderDeletingProgress::YACReaderDeletingProgress(QWidget *parent) :
|
|||||||
contentLayout->addSpacing(16);
|
contentLayout->addSpacing(16);
|
||||||
contentLayout->addWidget(iconLabel,0,Qt::AlignHCenter);
|
contentLayout->addWidget(iconLabel,0,Qt::AlignHCenter);
|
||||||
contentLayout->addSpacing(11);
|
contentLayout->addSpacing(11);
|
||||||
contentLayout->addWidget(title,0,Qt::AlignHCenter);
|
contentLayout->addWidget(textMessage,0,Qt::AlignHCenter);
|
||||||
contentLayout->addSpacing(13);
|
contentLayout->addSpacing(13);
|
||||||
contentLayout->addWidget(progressBar);
|
contentLayout->addWidget(progressBar);
|
||||||
contentLayout->addSpacing(13);
|
contentLayout->addSpacing(13);
|
||||||
@ -102,5 +102,5 @@ void YACReaderDeletingProgress::paintEvent(QPaintEvent * event)
|
|||||||
|
|
||||||
QSize YACReaderDeletingProgress::sizeHint() const
|
QSize YACReaderDeletingProgress::sizeHint() const
|
||||||
{
|
{
|
||||||
return QSize(410,184);
|
return QSize(textMessage->sizeHint().width()+120,185);
|
||||||
}
|
}
|
||||||
|
@ -3,6 +3,8 @@
|
|||||||
|
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
|
|
||||||
|
class QLabel;
|
||||||
|
|
||||||
class YACReaderDeletingProgress : public QWidget
|
class YACReaderDeletingProgress : public QWidget
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
@ -16,6 +18,9 @@ public slots:
|
|||||||
protected:
|
protected:
|
||||||
void paintEvent(QPaintEvent *);
|
void paintEvent(QPaintEvent *);
|
||||||
|
|
||||||
|
private:
|
||||||
|
QLabel * textMessage;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // YACREADER_DELETING_PROGRESS_H
|
#endif // YACREADER_DELETING_PROGRESS_H
|
||||||
|
57
custom_widgets/yacreader_table_view.cpp
Normal file
57
custom_widgets/yacreader_table_view.cpp
Normal file
@ -0,0 +1,57 @@
|
|||||||
|
#include "yacreader_table_view.h"
|
||||||
|
|
||||||
|
#include <QHeaderView>
|
||||||
|
#include <QResizeEvent>
|
||||||
|
|
||||||
|
#include "yacreader_deleting_progress.h"
|
||||||
|
|
||||||
|
YACReaderTableView::YACReaderTableView(QWidget *parent) :
|
||||||
|
QTableView(parent)
|
||||||
|
{
|
||||||
|
setAlternatingRowColors(true);
|
||||||
|
verticalHeader()->setAlternatingRowColors(true);
|
||||||
|
setStyleSheet("QTableView {alternate-background-color: #F2F2F2;background-color: #FAFAFA; outline: 0px;}"
|
||||||
|
"QTableCornerButton::section {background-color:#F5F5F5; border:none; border-bottom:1px solid #B8BDC4; border-right:1px solid qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #D1D1D1, stop: 1 #B8BDC4);}"
|
||||||
|
"QTableView::item {outline: 0px; border-bottom: 1px solid #DFDFDF;border-top: 1px solid #FEFEFE; padding-bottom:1px; color:#252626;}"
|
||||||
|
"QTableView::item:selected {outline: 0px; border-bottom: 1px solid #7A8080;border-top: 1px solid #7A8080; padding-bottom:1px; background-color: #7A8080; color: #FFFFFF; }"
|
||||||
|
"QHeaderView::section:horizontal {background-color:#F5F5F5; border-bottom:1px solid #B8BDC4; border-right:1px solid qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #D1D1D1, stop: 1 #B8BDC4); border-left:none; border-top:none; padding:4px; color:#313232;}"
|
||||||
|
"QHeaderView::section:vertical {border-bottom: 1px solid #DFDFDF;border-top: 1px solid #FEFEFE;}"
|
||||||
|
//"QTableView::item:hover {border-bottom: 1px solid #A3A3A3;border-top: 1px solid #A3A3A3; padding-bottom:1px; background-color: #A3A3A3; color: #FFFFFF; }"
|
||||||
|
"");
|
||||||
|
//comicView->setItemDelegate(new YACReaderComicViewDelegate());
|
||||||
|
setContextMenuPolicy(Qt::ActionsContextMenu);
|
||||||
|
|
||||||
|
setShowGrid(false);
|
||||||
|
|
||||||
|
verticalHeader()->setResizeMode(QHeaderView::Fixed);
|
||||||
|
|
||||||
|
//comicView->horizontalHeader()->setResizeMode(QHeaderView::ResizeToContents);
|
||||||
|
horizontalHeader()->setStretchLastSection(true);
|
||||||
|
horizontalHeader()->setClickable(false);
|
||||||
|
//comicView->verticalHeader()->setResizeMode(QHeaderView::ResizeToContents);
|
||||||
|
verticalHeader()->setDefaultSectionSize(24);
|
||||||
|
verticalHeader()->setClickable(false); //TODO comportamiento anómalo
|
||||||
|
setCornerButtonEnabled(false);
|
||||||
|
|
||||||
|
setSelectionBehavior(QAbstractItemView::SelectRows);
|
||||||
|
setSelectionMode(QAbstractItemView::ExtendedSelection);
|
||||||
|
|
||||||
|
deletingProgress = new YACReaderDeletingProgress(/*this*/);
|
||||||
|
}
|
||||||
|
|
||||||
|
void YACReaderTableView::showDeleteProgress()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void YACReaderTableView::hideDeleteProgress()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void YACReaderTableView::resizeEvent(QResizeEvent * event)
|
||||||
|
{
|
||||||
|
event->size();
|
||||||
|
|
||||||
|
deletingProgress->move((event->size().width()-deletingProgress->width())/2 ,1);
|
||||||
|
}
|
27
custom_widgets/yacreader_table_view.h
Normal file
27
custom_widgets/yacreader_table_view.h
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
#ifndef YACREADER_TABLE_VIEW_H
|
||||||
|
#define YACREADER_TABLE_VIEW_H
|
||||||
|
|
||||||
|
#include <QTableView>
|
||||||
|
|
||||||
|
class YACReaderDeletingProgress;
|
||||||
|
class QResizeEvent;
|
||||||
|
|
||||||
|
class YACReaderTableView : public QTableView
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
public:
|
||||||
|
explicit YACReaderTableView(QWidget *parent = 0);
|
||||||
|
|
||||||
|
signals:
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
void showDeleteProgress();
|
||||||
|
void hideDeleteProgress();
|
||||||
|
|
||||||
|
private:
|
||||||
|
YACReaderDeletingProgress * deletingProgress;
|
||||||
|
|
||||||
|
void resizeEvent(QResizeEvent * event);
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // YACREADER_TABLE_VIEW_H
|
Loading…
x
Reference in New Issue
Block a user