diff --git a/YACReader/images.qrc b/YACReader/images.qrc index 88004c76..31273fcb 100644 --- a/YACReader/images.qrc +++ b/YACReader/images.qrc @@ -47,6 +47,11 @@ ../images/imgGoToSlide.png ../images/imgCenterSlidePressed.png ../images/imgGoToSlidePressed.png + ../images/sliderBackground.png + ../images/sliderGround.png + ../images/sliderSubPage.png + ../images/sliderAddPage.png + ../images/sliderHandle.png ../images/helpImages/open.png ../images/helpImages/openFolder.png diff --git a/YACReader/main_window_viewer.cpp b/YACReader/main_window_viewer.cpp index 67e6ebbb..1aead5b6 100644 --- a/YACReader/main_window_viewer.cpp +++ b/YACReader/main_window_viewer.cpp @@ -320,7 +320,19 @@ void MainWindowViewer::createToolBars() //comicToolBar->addWidget(widget); - comicToolBar->addAction(adjustWidth); + //comicToolBar->addAction(adjustWidth); + QMenu * menu = new QMenu(); + menu->setAutoFillBackground(false); + menu->setStyleSheet(" QMenu {background:transparent; border: 0px;padding: 0px; }" + ); + menu->addAction(new YACReaderSliderAction(this)); + QToolButton * tb2 = new QToolButton(); + tb2->addAction(adjustWidth); + tb2->setMenu(menu); + //tb2->addAction(); + tb2->setPopupMode(QToolButton::MenuButtonPopup); + tb2->setDefaultAction(adjustWidth); + comicToolBar->addWidget(tb2); comicToolBar->addAction(adjustToFullSizeAction); comicToolBar->addAction(leftRotationAction); comicToolBar->addAction(rightRotationAction); diff --git a/common/custom_widgets.cpp b/common/custom_widgets.cpp index bbcc909c..c398c649 100644 --- a/common/custom_widgets.cpp +++ b/common/custom_widgets.cpp @@ -1205,4 +1205,67 @@ YACReaderFlowConfigWidget::YACReaderFlowConfigWidget(QWidget * parent ) layout->setContentsMargins(0,0,0,0); setLayout(layout); +} + + +YACReaderSliderAction::YACReaderSliderAction (QWidget * parent) + :QWidgetAction (0) { + + //QWidget* pWidget = new QWidget (0); + + //QLabel* imgLabel = new QLabel(pWidget); + //QPixmap p(":/images/numPagesLabel.png"); + //imgLabel->resize(p.size()); + //imgLabel->setPixmap(p); + + //QLabel * textLabel = new QLabel(pWidget); + //textLabel->setAlignment(Qt::AlignVCenter|Qt::AlignHCenter); + //textLabel->setStyleSheet("QLabel { color : white; }"); + //textLabel->setText("hola"); + ////informationLabel->setAutoFillBackground(true); + ////textLabel->setFont(QFont("courier new bold", 12)); + ////textLabel->resize(100,25); + + //textLabel->setGeometry(imgLabel->geometry()); + + //setDefaultWidget(pWidget); + + QWidget* pWidget = new QWidget (NULL); + QHBoxLayout* pLayout = new QHBoxLayout(); + QLabel * pLabel = new QLabel ("100%"); + pLabel->setStyleSheet("QLabel { color : white; }"); + pLayout->addWidget (pLabel); + QSlider * slider = new QSlider(NULL); + slider->setOrientation(Qt::Horizontal); + pLayout->addWidget (slider); + //"background-image: url(:/images/sliderGround.png); width: 100%; height:100%; background-repeat: none; border: none; padding: 0px; color: white;" + //"QSlider::sub-page:horizontal {background-image: url(:/images/sliderSubPage.png); background-repeat:repeat-x;}" + QString sliderCSS = "QSlider {background-image: url(:/images/sliderGround.png); width: 100%; height:100%; background-repeat: none; border: none; padding: 0px;} " + + "QSlider::sub-page:horizontal {background-image: url(:/images/sliderSubPage.png); border: 0px; margin-left: 18px;}" + "QSlider::add-page:horizontal {background-image: url(:/images/sliderAddPage.png); border: 0px; margin-right: 18px;}" + "QSlider::handle:horizontal {image: url(:/images/sliderHandle.png); width: 100px;height:45px;padding:-20px; margin-left:-10px; margin-right:-10px; }" + //"QSlider::groove:horizontal {border-image:url(:/images/sliderGround.png); border-left:-10px; border-right:-10px;}" + ; + + //"QSlider::handle {background-image: url(:/images/sliderHandle.png); border: 0px; width: 31px; height:45px; margin:0px; padding:0px;}" + slider->setStyleSheet(sliderCSS); + slider->setFixedSize(214,45); + + QLabel* imgLabel = new QLabel(pWidget); + QPixmap p(":/images/sliderBackground.png"); + imgLabel->resize(p.size()); + imgLabel->setPixmap(p); + + pLayout->setMargin(0); + pLayout->setSpacing(0); + + pWidget->setLayout (pLayout); + pWidget->setAutoFillBackground(false); + + //pWidget->setMinimumSize(250,45); + + setDefaultWidget(pWidget); + + } \ No newline at end of file diff --git a/common/custom_widgets.h b/common/custom_widgets.h index 01cc8f77..d78c7b8d 100644 --- a/common/custom_widgets.h +++ b/common/custom_widgets.h @@ -366,6 +366,16 @@ signals: void optionsChanged(); }; +////////////////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////// +////////////////////////////////////////////////////////////////////////// + +class YACReaderSliderAction : public QWidgetAction { +public: + YACReaderSliderAction (QWidget * parent = 0); +}; + #endif diff --git a/images/sliderAddPage.png b/images/sliderAddPage.png new file mode 100644 index 00000000..1c285196 Binary files /dev/null and b/images/sliderAddPage.png differ diff --git a/images/sliderBackground.png b/images/sliderBackground.png new file mode 100644 index 00000000..d2d31325 Binary files /dev/null and b/images/sliderBackground.png differ diff --git a/images/sliderGround.png b/images/sliderGround.png new file mode 100644 index 00000000..1f427f3c Binary files /dev/null and b/images/sliderGround.png differ diff --git a/images/sliderHandle.png b/images/sliderHandle.png new file mode 100644 index 00000000..4c8730bf Binary files /dev/null and b/images/sliderHandle.png differ diff --git a/images/sliderSubPage.png b/images/sliderSubPage.png new file mode 100644 index 00000000..404b296f Binary files /dev/null and b/images/sliderSubPage.png differ