Skip to content

Commit

Permalink
menus in explore browsers
Browse files Browse the repository at this point in the history
  • Loading branch information
kaniol-lck committed Feb 17, 2022
1 parent 8ced2e4 commit fe55038
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 9 deletions.
10 changes: 5 additions & 5 deletions src/qss/light.qss
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@ QWidget:focus{
}

Widget {
background-color: #fff;
background-color: #ffffff;
}

QWidget[enabled=false] {
background-color: #cfcfcf;
}

QScrollArea, QScrollArea .QWidget {
Expand Down Expand Up @@ -193,7 +197,3 @@ QTabBar::tab:selected {
border: 1px solid gray;
background-color: white;
}

QWidget[enabled=false] {
background-color: #cfcfcf;
}
20 changes: 17 additions & 3 deletions src/ui/explorebrowser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,9 @@ ExploreBrowser::ExploreBrowser(QWidget *parent, const QIcon &icon, const QString
statusBar_->addPermanentWidget(statusBarWidget_);
connect(statusBarWidget_, &ExploreStatusBarWidget::viewModeChanged, stackedWidget_, &QStackedWidget::setCurrentIndex);

connect(modListView_, &QWidget::customContextMenuRequested, this, &ExploreBrowser::onCustomContextMenuRequested);
connect(modListView_, &QWidget::customContextMenuRequested, this, &ExploreBrowser::on_modListView_customContextMenuRequested);
connect(modIconListView_, &QWidget::customContextMenuRequested, this, &ExploreBrowser::on_modIconListView_customContextMenuRequested);
connect(modTreeView_, &QWidget::customContextMenuRequested, this, &ExploreBrowser::on_modTreeView_customContextMenuRequested);
connect(modListView_->verticalScrollBar(), &QScrollBar::valueChanged, this , &ExploreBrowser::onListSliderChanged);
connect(modIconListView_->verticalScrollBar(), &QScrollBar::valueChanged, this , &ExploreBrowser::onIconListSliderChanged);
connect(modTreeView_->verticalScrollBar(), &QScrollBar::valueChanged, this , &ExploreBrowser::onTreeSliderChanged);
Expand Down Expand Up @@ -156,10 +158,22 @@ void ExploreBrowser::updateTreeViewIndexWidget()
}
}

void ExploreBrowser::onCustomContextMenuRequested(const QPoint &pos)
void ExploreBrowser::on_modListView_customContextMenuRequested(const QPoint &pos)
{
if(auto menu = getCustomContextMenu())
menu->exec(modListView_->mapToGlobal(pos));
menu->exec(modListView_->viewport()->mapToGlobal(pos));
}

void ExploreBrowser::on_modIconListView_customContextMenuRequested(const QPoint &pos)
{
if(auto menu = getCustomContextMenu())
menu->exec(modIconListView_->viewport()->mapToGlobal(pos));
}

void ExploreBrowser::on_modTreeView_customContextMenuRequested(const QPoint &pos)
{
if(auto menu = getCustomContextMenu())
menu->exec(modTreeView_->viewport()->mapToGlobal(pos));
}

void ExploreBrowser::onDoubleClicked(const QModelIndex &index)
Expand Down
4 changes: 3 additions & 1 deletion src/ui/explorebrowser.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,9 @@ private slots:
void onItemSelected();
void updateListViewIndexWidget();
void updateTreeViewIndexWidget();
void onCustomContextMenuRequested(const QPoint &pos);
void on_modListView_customContextMenuRequested(const QPoint &pos);
void on_modIconListView_customContextMenuRequested(const QPoint &pos);
void on_modTreeView_customContextMenuRequested(const QPoint &pos);
void onDoubleClicked(const QModelIndex &index);

protected:
Expand Down

0 comments on commit fe55038

Please sign in to comment.