add pixmaps to image viewer buttons

This commit is contained in:
Axel Kohlmeyer
2023-08-11 02:40:08 -04:00
parent 2e0e3d9204
commit 93e67c9388
9 changed files with 36 additions and 12 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

View File

@ -58,12 +58,12 @@ ImageViewer::ImageViewer(const QString &fileName, LammpsWrapper *_lammps, QWidge
QVBoxLayout *mainLayout = new QVBoxLayout; QVBoxLayout *mainLayout = new QVBoxLayout;
auto *zoomin = new QPushButton("Zoom In"); auto *zoomin = new QPushButton(QIcon(":/gtk-zoom-in.png"), "Zoom In");
auto *zoomout = new QPushButton("Zoom Out"); auto *zoomout = new QPushButton(QIcon(":/gtk-zoom-out.png"),"Zoom Out");
auto *rotleft = new QPushButton("Rotate Left"); auto *rotleft = new QPushButton(QIcon(":/object-rotate-left.png"), "Rotate Left");
auto *rotright = new QPushButton("Rotate Right"); auto *rotright = new QPushButton(QIcon(":/object-rotate-right.png"), "Rotate Right");
auto *rotup = new QPushButton("Rotate Up"); auto *rotup = new QPushButton(QIcon(":/gtk-go-up.png"),"Rotate Up");
auto *rotdown = new QPushButton("Rotate Down"); auto *rotdown = new QPushButton(QIcon(":/gtk-go-down.png"),"Rotate Down");
auto *combo = new QComboBox; auto *combo = new QComboBox;
combo->setObjectName("group"); combo->setObjectName("group");
int ngroup = lammps->id_count("group"); int ngroup = lammps->id_count("group");
@ -131,31 +131,31 @@ void ImageViewer::do_zoom_out()
createImage(); createImage();
} }
void ImageViewer::do_rot_right() void ImageViewer::do_rot_left()
{ {
vrot -= 15; vrot -= 15;
if (vrot < 0) vrot += 360; if (vrot < -180) vrot += 360;
createImage(); createImage();
} }
void ImageViewer::do_rot_left() void ImageViewer::do_rot_right()
{ {
vrot += 15; vrot += 15;
if (vrot > 360) vrot -= 360; if (vrot > 180) vrot -= 360;
createImage(); createImage();
} }
void ImageViewer::do_rot_down() void ImageViewer::do_rot_down()
{ {
hrot -= 15; hrot -= 15;
if (hrot < 0) hrot += 360; if (hrot < -0) hrot += 180;
createImage(); createImage();
} }
void ImageViewer::do_rot_up() void ImageViewer::do_rot_up()
{ {
hrot += 15; hrot += 15;
if (hrot > 360) hrot -= 360; if (hrot > 180) hrot -= 180;
createImage(); createImage();
} }
@ -269,14 +269,17 @@ void ImageViewer::createActions()
zoomInAct = viewMenu->addAction(tr("Image Zoom &In (25%)"), this, &ImageViewer::zoomIn); zoomInAct = viewMenu->addAction(tr("Image Zoom &In (25%)"), this, &ImageViewer::zoomIn);
zoomInAct->setShortcut(QKeySequence::ZoomIn); zoomInAct->setShortcut(QKeySequence::ZoomIn);
zoomInAct->setIcon(QIcon(":/gtk-zoom-in.png"));
zoomInAct->setEnabled(false); zoomInAct->setEnabled(false);
zoomOutAct = viewMenu->addAction(tr("Image Zoom &Out (25%)"), this, &ImageViewer::zoomOut); zoomOutAct = viewMenu->addAction(tr("Image Zoom &Out (25%)"), this, &ImageViewer::zoomOut);
zoomOutAct->setShortcut(QKeySequence::ZoomOut); zoomOutAct->setShortcut(QKeySequence::ZoomOut);
zoomInAct->setIcon(QIcon(":/gtk-zoom-out.png"));
zoomOutAct->setEnabled(false); zoomOutAct->setEnabled(false);
normalSizeAct = viewMenu->addAction(tr("&Reset Image Size"), this, &ImageViewer::normalSize); normalSizeAct = viewMenu->addAction(tr("&Reset Image Size"), this, &ImageViewer::normalSize);
normalSizeAct->setShortcut(tr("Ctrl+0")); normalSizeAct->setShortcut(tr("Ctrl+0"));
zoomInAct->setIcon(QIcon(":/gtk-zoom-fit.png"));
normalSizeAct->setEnabled(false); normalSizeAct->setEnabled(false);
viewMenu->addSeparator(); viewMenu->addSeparator();

View File

@ -2,4 +2,25 @@
<qresource> <qresource>
<file>lammps-icon-128x128.png</file> <file>lammps-icon-128x128.png</file>
</qresource> </qresource>
<qresource>
<file>gtk-zoom-in.png</file>
</qresource>
<qresource>
<file>gtk-zoom-out.png</file>
</qresource>
<qresource>
<file>gtk-zoom-fit.png</file>
</qresource>
<qresource>
<file>object-rotate-right.png</file>
</qresource>
<qresource>
<file>object-rotate-left.png</file>
</qresource>
<qresource>
<file>gtk-go-up.png</file>
</qresource>
<qresource>
<file>gtk-go-down.png</file>
</qresource>
</RCC> </RCC>

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB