| 5137 | } |
| 5138 | |
| 5139 | void CCNotePad::initFileListDockWin() |
| 5140 | { |
| 5141 | //停靠窗口1 |
| 5142 | if (m_dockFileListWin.isNull()) |
| 5143 | { |
| 5144 | m_dockFileListWin = new QDockWidget(tr("File List"), this); |
| 5145 | connect(m_dockFileListWin, &QDockWidget::dockLocationChanged, this, [](Qt::DockWidgetArea area) { |
| 5146 | NddSetting::updataKeyValueFromNumSets(FILELISTPOS, area); |
| 5147 | }); |
| 5148 | |
| 5149 | connect(m_dockFileListWin, &QObject::destroyed, this, [this] { |
| 5150 | if (ui.actionFileListView->isChecked()) |
| 5151 | { |
| 5152 | ui.actionFileListView->setChecked(false); |
| 5153 | } |
| 5154 | }); |
| 5155 | m_dockFileListWin->setAttribute(Qt::WA_DeleteOnClose); |
| 5156 | m_dockFileListWin->layout()->setMargin(0); |
| 5157 | m_dockFileListWin->layout()->setSpacing(0); |
| 5158 | |
| 5159 | //暂时不提供关闭,因为关闭后需要同步菜单的check状态 |
| 5160 | |
| 5161 | m_dockFileListWin->setFeatures(QDockWidget::DockWidgetFloatable | QDockWidget::DockWidgetClosable | QDockWidget::DockWidgetMovable); |
| 5162 | m_dockFileListWin->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea); |
| 5163 | |
| 5164 | m_fileListView = new FileListView(m_dockFileListWin); |
| 5165 | m_fileListView->setNotepadWin(this); |
| 5166 | |
| 5167 | connect(m_fileListView, &FileListView::itemDoubleClicked, this, &CCNotePad::slot_fileListItemDoubleClick); |
| 5168 | |
| 5169 | m_dockFileListWin->setWidget(m_fileListView); |
| 5170 | |
| 5171 | int lastArea = NddSetting::getKeyValueFromNumSets(FILELISTPOS); |
| 5172 | if (lastArea == 0) |
| 5173 | { |
| 5174 | lastArea = Qt::LeftDockWidgetArea; |
| 5175 | } |
| 5176 | |
| 5177 | addDockWidget((Qt::DockWidgetArea)lastArea, m_dockFileListWin); |
| 5178 | |
| 5179 | if (!ui.actionFileListView->isChecked()) |
| 5180 | { |
| 5181 | ui.actionFileListView->setChecked(true); |
| 5182 | } |
| 5183 | } |
| 5184 | m_dockFileListWin->show(); |
| 5185 | } |
| 5186 | |
| 5187 | static QString fileSuffix(const QString& filePath) |
| 5188 | { |
nothing calls this directly
no test coverage detected