Skip to content

Commit

Permalink
Add grid color selection to SplitViewWidget menu
Browse files Browse the repository at this point in the history
  • Loading branch information
adamws committed Nov 21, 2022
1 parent 1966a97 commit 6e72a09
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
18 changes: 16 additions & 2 deletions YUViewLib/src/ui/views/SplitViewWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@

#include <QActionGroup>
#include <QBackingStore>
#include <QColorDialog>
#include <QDockWidget>
#include <QInputDialog>
#include <QMessageBox>
Expand Down Expand Up @@ -1387,6 +1388,16 @@ void splitViewWidget::setRegularGridSize(unsigned int size,
update();
}

void splitViewWidget::selectRegularGridColor()
{
QColor newColor = QColorDialog::getColor(regularGridColor);
if (newColor.isValid() && regularGridColor != newColor)
{
regularGridColor = newColor;
update();
}
}

void splitViewWidget::currentSelectedItemsChanged(playlistItem *item1, playlistItem *item2)
{
Q_ASSERT_X(this->isMasterView, Q_FUNC_INFO, "Call this function only on the primary widget.");
Expand Down Expand Up @@ -1946,9 +1957,12 @@ void splitViewWidget::addMenuActions(QMenu *menu)
splitViewMenu->addAction(&actionSplitView[i]);
splitViewMenu->setToolTipsVisible(true);

QMenu *drawGridMenu = menu->addMenu("Draw Grid");
QMenu *gridSettingsMenu = menu->addMenu("Grid Settings");
QMenu *gridSizeMenu = gridSettingsMenu->addMenu("Size");
for (size_t i = 0; i < 6; i++)
drawGridMenu->addAction(&actionGrid[i]);
gridSizeMenu->addAction(&actionGrid[i]);

gridSettingsMenu->addAction("Select Color", this, &splitViewWidget::selectRegularGridColor);

menu->addAction(&actionZoomBox);

Expand Down
1 change: 1 addition & 0 deletions YUViewLib/src/ui/views/SplitViewWidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,7 @@ private slots:
unsigned int regularGridSize{0}; //!< The size of each block in the regular grid in pixels
void
setRegularGridSize(unsigned int size, bool setOtherViewIfLinked = true, bool callUpdate = false);
void selectRegularGridColor();
QColor regularGridColor;
void paintRegularGrid(QPainter *painter, playlistItem *item); //!< paint the grid

Expand Down

0 comments on commit 6e72a09

Please sign in to comment.