replaced context menu by grid/list toolbuttons

This commit is contained in:
csoler 2020-08-28 21:53:24 +02:00
parent 503aa9929f
commit bfee7a0266
4 changed files with 46 additions and 1 deletions

View File

@ -290,7 +290,13 @@ GxsChannelPostsWidgetWithModel::GxsChannelPostsWidgetWithModel(const RsGxsGroupI
/* Invoke the Qt Designer generated object setup routine */
ui->setupUi(this);
ui->postsTree->setModel(mChannelPostsModel = new RsGxsChannelPostsModel());
ui->list_TB->setIcon(FilesDefs::getIconFromQtResourcePath(":Posted/images/classic.png"));
ui->grid_TB->setIcon(FilesDefs::getIconFromQtResourcePath(":icons/svg/gridlayout.svg"));
connect(ui->list_TB,SIGNAL(clicked()),this,SLOT(switchView()));
connect(ui->grid_TB,SIGNAL(clicked()),this,SLOT(switchView()));
ui->postsTree->setModel(mChannelPostsModel = new RsGxsChannelPostsModel());
ui->postsTree->setItemDelegate(mChannelPostsDelegate = new ChannelPostDelegate());
ui->postsTree->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); // prevents bug on w10, since row size depends on widget width
ui->postsTree->setHorizontalScrollMode(QAbstractItemView::ScrollPerPixel);// more beautiful if we scroll at pixel level
@ -455,11 +461,17 @@ void GxsChannelPostsWidgetWithModel::switchView()
{
if(mChannelPostsModel->getMode() == RsGxsChannelPostsModel::TREE_MODE_GRID)
{
whileBlocking(ui->list_TB)->setChecked(true);
whileBlocking(ui->grid_TB)->setChecked(false);
mChannelPostsDelegate->setWidgetGrid(false);
mChannelPostsModel->setMode(RsGxsChannelPostsModel::TREE_MODE_LIST);
}
else
{
whileBlocking(ui->list_TB)->setChecked(false);
whileBlocking(ui->grid_TB)->setChecked(true);
mChannelPostsDelegate->setWidgetGrid(true);
mChannelPostsModel->setMode(RsGxsChannelPostsModel::TREE_MODE_GRID);

View File

@ -120,6 +120,26 @@
</property>
</spacer>
</item>
<item>
<widget class="QToolButton" name="grid_TB">
<property name="text">
<string>...</string>
</property>
<property name="checkable">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="list_TB">
<property name="text">
<string>...</string>
</property>
<property name="checkable">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="viewModeLayout">
<property name="spacing">

View File

@ -4,6 +4,8 @@
<file>icons/svg/hidden.svg</file>
<file>icons/svg/randomness.svg</file>
<file>icons/svg/password.svg</file>
<file>Posted/images/classic.png</file>
<file>icons/svg/gridlayout.svg</file>
<file>icons/stars/star0.png</file>
<file>icons/stars/star1.png</file>
<file>icons/stars/star2.png</file>

View File

@ -0,0 +1,11 @@
<?xml version="1.0"?>
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" id="Capa_1" x="0px" y="0px" width="512px" height="512px" viewBox="0 0 35 35" style="enable-background:new 0 0 35 35;" xml:space="preserve" class=""><g transform="matrix(0.922745 0 0 0.922745 1.35197 1.35197)"><g>
<g>
<rect width="9.182" height="15.5" data-original="#000000" class="active-path" data-old_color="#000000" fill="#039BD5"/>
<rect y="19.5" width="9.182" height="15.5" data-original="#000000" class="active-path" data-old_color="#000000" fill="#039BD5"/>
<rect x="12.9" y="19.5" width="9.202" height="15.5" data-original="#000000" class="active-path" data-old_color="#000000" fill="#039BD5"/>
<rect x="12.9" width="9.202" height="15.5" data-original="#000000" class="active-path" data-old_color="#000000" fill="#039BD5"/>
<rect x="25.82" width="9.18" height="15.5" data-original="#000000" class="active-path" data-old_color="#000000" fill="#039BD5"/>
<rect x="25.82" y="19.5" width="9.18" height="15.5" data-original="#000000" class="active-path" data-old_color="#000000" fill="#039BD5"/>
</g>
</g></g> </svg>

After

Width:  |  Height:  |  Size: 1.1 KiB