[Add] Added Rotary buttons

This commit is contained in:
Rtch90 2014-12-19 15:37:49 +00:00
parent a4b88ab1ff
commit 528b955d16
7 changed files with 45 additions and 15 deletions

View File

@ -27,5 +27,23 @@ SOURCES += \
RESOURCES += hpdf.qrc
CONFIG += console
#CONFIG += console
macx {
CONFIG(release, debug|release) {
DESTDIR = ../bin/
}
}
win32 {
CONFIG(release, debug|release) {
DESTDIR = ../bin/
}
}
linux {
CONFIG(release, debug|release) {
DESTDIR = ../bin/
}
}

View File

@ -12,5 +12,6 @@
<file>../img/collapse.png</file>
<file>../img/expand.png</file>
<file>../img/remove.png</file>
<file>../img/rotate.png</file>
</qresource>
</RCC>

BIN
img/delete.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.1 KiB

BIN
img/rotate.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

View File

@ -63,16 +63,16 @@ void PDFFactory::createActions(void) {
openAction->setStatusTip(tr("Open a PDF"));
connect(openAction, SIGNAL(triggered()), this, SLOT(openFile()));
exportAction = new QAction(tr("&Export"), this);
exportAction = new QAction(tr("&Export a single file"), this);
exportAction->setIcon(QIcon(":/img/export.png"));
exportAction->setShortcut(tr("Ctrl+S"));
exportAction->setStatusTip(tr("Export the selected frame to a new PDF"));
exportAction->setStatusTip(tr("Export the selected file to a new PDF"));
/*connect(saveAction, SIGNAL(triggered()), this, SLOT(save()))*/
exportAllAction = new QAction(tr("Combine all and export"), this);
exportAllAction = new QAction(tr("Combine all"), this);
exportAllAction->setIcon(QIcon(":/img/exportall.png"));
exportAllAction->setShortcut(tr("Shift+Ctrl+S"));
exportAllAction->setStatusTip(tr("Combine all and export as one PDF"));
exportAllAction->setStatusTip(tr("Export all to multiple PDF files"));
/*connect(saveAsAction, SIGNAL(triggered()), this, SLOT(saveAs()))*/
cutAction = new QAction(tr("C&ut"), this);
@ -140,7 +140,7 @@ void PDFFactory::createStatusBar(void) {
statusBar()->showMessage(tr(""));
}
void PDFFactory::openFile() {
void PDFFactory::openFile(void) {
QStringList fileNames = QFileDialog::getOpenFileNames(this,
tr("Open PDF file"), ".",
tr("PDF file (*.pdf)"));

View File

@ -17,24 +17,33 @@ PDFPageWidget::PDFPageWidget(QWidget* parent) :
this->setMouseTracking(true);
this->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
QHBoxLayout* hbox = new QHBoxLayout();
QHBoxLayout* topHBox = new QHBoxLayout();
btnRotate = new QPushButton("", this);
btnRotate->setObjectName("rotate");
btnRotate->setIcon(QPixmap::fromImage(QImage("img/rotate.png")));
btnRotate->hide();
topHBox->addWidget(btnRotate, 0, Qt::AlignLeft);
QHBoxLayout* bottomHBox = new QHBoxLayout();
btnCut = new QPushButton("", this);
btnCut->setObjectName("cut");
btnCut->setIcon(QPixmap::fromImage(QImage("img/cut.png")));
btnCut->hide();
btnCopy = new QPushButton("", this);
btnCopy->setObjectName("copy");
btnCut->setIcon(QPixmap::fromImage(QImage("img/cut.png")));
btnCopy->setIcon(QPixmap::fromImage(QImage("img/copy.png")));
btnCut->hide();
btnCopy->hide();
hbox->addWidget(btnCut, 0, Qt::AlignLeft);
hbox->addWidget(btnCopy, 1, Qt::AlignRight);
bottomHBox->addWidget(btnCut, 0, Qt::AlignLeft);
bottomHBox->addWidget(btnCopy, 1, Qt::AlignRight);
QVBoxLayout* vbox = new QVBoxLayout();
vbox->addLayout(topHBox);
vbox->addStretch(1);
vbox->addLayout(hbox);
vbox->addLayout(bottomHBox);
vbox->setContentsMargins(0, 3, 0, 3);
this->setLayout(vbox);
}
@ -92,6 +101,7 @@ void PDFPageWidget::dropEvent(QDropEvent* event) {
}
void PDFPageWidget::leaveEvent(QEvent* event) {
btnRotate->hide();
btnCut->hide();
btnCopy->hide();
@ -99,6 +109,7 @@ void PDFPageWidget::leaveEvent(QEvent* event) {
}
void PDFPageWidget::enterEvent(QEvent* event) {
btnRotate->show();
btnCut->show();
btnCopy->show();

View File

@ -44,7 +44,7 @@ private:
QImage image;
Poppler::Page* pPage;
QPixmap pixmap;
QPushButton* btnCut, *btnCopy;
QPushButton* btnRotate, *btnCut, *btnCopy;
bool selected;