a?adido y maquetado slider para controlar el ancho de p?gina desde la toolbar

This commit is contained in:
Luis Ángel San Martín 2013-02-07 18:01:08 +01:00
parent db44c6a780
commit 972da79d53
9 changed files with 91 additions and 1 deletions

View File

@ -47,6 +47,11 @@
<file>../images/imgGoToSlide.png</file>
<file>../images/imgCenterSlidePressed.png</file>
<file>../images/imgGoToSlidePressed.png</file>
<file>../images/sliderBackground.png</file>
<file>../images/sliderGround.png</file>
<file>../images/sliderSubPage.png</file>
<file>../images/sliderAddPage.png</file>
<file>../images/sliderHandle.png</file>
<file>../images/helpImages/open.png</file>
<file>../images/helpImages/openFolder.png</file>

View File

@ -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);

View File

@ -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);
}

View File

@ -366,6 +366,16 @@ signals:
void optionsChanged();
};
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////
class YACReaderSliderAction : public QWidgetAction {
public:
YACReaderSliderAction (QWidget * parent = 0);
};
#endif

BIN
images/sliderAddPage.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 186 B

BIN
images/sliderBackground.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 304 B

BIN
images/sliderGround.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 955 B

BIN
images/sliderHandle.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 868 B

BIN
images/sliderSubPage.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 182 B