添加了默认视图图标,修复了替换视图的小bug

This commit is contained in:
codeboss 2024-02-10 16:25:41 +08:00
parent 2af38a4937
commit df2d145809
7 changed files with 25 additions and 5 deletions

View File

@ -130,11 +130,17 @@ void accept_panel::AcceptPanel::dropEvent(QDropEvent *ev)
view_manager->doRetrieve(view);
view_manager->siblingAttach(view, anchor_view, SplitType::SPLIT_V_BFIRST);
break;
case HoverType::CUBE_CENTER:
case HoverType::CUBE_CENTER: {
view_manager->doRetrieve(view);
anchor_view->parentRes()->replaceView(view, anchor_view);
auto pinst = anchor_view->parentRes();
if(pinst){
pinst->replaceView(view, anchor_view);
view_manager->doRetrieve(anchor_view);
break;
}else{
view_manager->doRetrieve(anchor_view);
dynamic_cast<split_window::SplitWindow*>(view_manager)->setPresentTarget(view);
}
} break;
default:
break;
}

View File

@ -13,6 +13,7 @@ using namespace dock_panel;
DragHeader::DragHeader(const QString &title, DockableView *bind_core)
: QFrame(bind_core),
bind_core(bind_core),
icon_holder(new QLabel(this)),
title_holder(new QLabel(this)),
close_btn(new QPushButton("x",this)),
minimal_btn(new QPushButton("-",this)) {
@ -22,6 +23,9 @@ DragHeader::DragHeader(const QString &title, DockableView *bind_core)
layout->setSpacing(0);
layout->setContentsMargins(0, 0, 0, 0);
icon_holder->setPixmap(QIcon(":/icons/headertop/story.png").pixmap(22,22));
layout->addWidget(icon_holder, 0, Qt::AlignLeft);
title_holder->setText(title);
title_holder->setContentsMargins(2,0, 0, 0);
layout->addWidget(title_holder, 1, Qt::AlignLeft);
@ -51,7 +55,7 @@ void DragHeader::setTitle(const QString &title)
void DragHeader::setTitle(const QString &title, const QIcon &icon)
{
this->setTitle(title);
this->title_holder->setPixmap(icon.pixmap(22, 22));
this->icon_holder->setPixmap(icon.pixmap(22, 22));
}
void DragHeader::optConfig(bool retrieve, bool close)

View File

@ -18,6 +18,7 @@ namespace dock_panel {
Q_OBJECT
private:
DockableView *const bind_core;
QLabel *const icon_holder;
QLabel *const title_holder;
QPushButton *const close_btn, *const minimal_btn;
std::tuple<bool, QPointF> press_flag = std::make_tuple(false, QPointF());

View File

@ -44,6 +44,7 @@ void SplitWindow::setPresentTarget(split_frame::ViewRes *inst)
inst->setParentRes(nullptr);
inst->widget()->setParent(this);
this->setCentralWidget(inst->widget());
inst->setVisible(true);
} else if (!inst) {
this->takeCentralWidget();
}

View File

@ -0,0 +1,5 @@
<RCC>
<qresource prefix="/icons/headertop">
<file>story.png</file>
</qresource>
</RCC>

View File

@ -40,3 +40,6 @@ else:unix: LIBS += -L$$OUT_PWD/../libConfig/ -llibConfig
INCLUDEPATH += $$PWD/../libConfig
DEPENDPATH += $$PWD/../libConfig
RESOURCES += \
defaulticon.qrc

BIN
libSplitView/story.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB