Changeset View
Changeset View
Standalone View
Standalone View
krusader/Panel/krlayoutfactory.cpp
Show All 15 Lines | |||||
16 | * * | 16 | * * | ||
17 | * You should have received a copy of the GNU General Public License * | 17 | * You should have received a copy of the GNU General Public License * | ||
18 | * along with Krusader. If not, see [http://www.gnu.org/licenses/]. * | 18 | * along with Krusader. If not, see [http://www.gnu.org/licenses/]. * | ||
19 | *****************************************************************************/ | 19 | *****************************************************************************/ | ||
20 | 20 | | |||
21 | #include "krlayoutfactory.h" | 21 | #include "krlayoutfactory.h" | ||
22 | 22 | | |||
23 | #include "listpanelframe.h" | 23 | #include "listpanelframe.h" | ||
24 | #include "listpanel.h" | ||||
24 | #include "../krglobal.h" | 25 | #include "../krglobal.h" | ||
25 | 26 | | |||
26 | // QtCore | 27 | // QtCore | ||
27 | #include <QDebug> | 28 | #include <QDebug> | ||
28 | #include <QMetaEnum> | 29 | #include <QMetaEnum> | ||
29 | #include <QFile> | 30 | #include <QFile> | ||
30 | #include <QResource> | 31 | #include <QResource> | ||
31 | #include <QStandardPaths> | 32 | #include <QStandardPaths> | ||
▲ Show 20 Lines • Show All 253 Lines • ▼ Show 20 Line(s) | 269 | { | |||
285 | 286 | | |||
286 | QMetaEnum shapeEnum = QFrame::staticMetaObject.enumerator(QFrame::staticMetaObject.indexOfEnumerator("Shape")); | 287 | QMetaEnum shapeEnum = QFrame::staticMetaObject.enumerator(QFrame::staticMetaObject.indexOfEnumerator("Shape")); | ||
287 | QString cfgShape = cg.readEntry("FrameShape", "default"); | 288 | QString cfgShape = cg.readEntry("FrameShape", "default"); | ||
288 | if(cfgShape!= "default") | 289 | if(cfgShape!= "default") | ||
289 | shape = shapeEnum.keyToValue(cfgShape.toLatin1().data()); | 290 | shape = shapeEnum.keyToValue(cfgShape.toLatin1().data()); | ||
290 | if(shape < 0) | 291 | if(shape < 0) | ||
291 | shape = shapeEnum.keyToValue(e.attribute("shape").toLatin1().data()); | 292 | shape = shapeEnum.keyToValue(e.attribute("shape").toLatin1().data()); | ||
292 | 293 | | |||
293 | QFrame *frame = new ListPanelFrame(parent, color); | 294 | ListPanelFrame *frame = new ListPanelFrame(parent, color); | ||
294 | frame->setFrameStyle(shape | shadow); | 295 | frame->setFrameStyle(shape | shadow); | ||
295 | frame->setAcceptDrops(true); | 296 | frame->setAcceptDrops(true); | ||
296 | 297 | | |||
297 | if(QLayout *l = createLayout(e, frame)) { | 298 | if(QLayout *l = createLayout(e, frame)) { | ||
298 | l->setContentsMargins(frame->frameWidth(), frame->frameWidth(), frame->frameWidth(), frame->frameWidth()); | 299 | l->setContentsMargins(frame->frameWidth(), frame->frameWidth(), frame->frameWidth(), frame->frameWidth()); | ||
299 | frame->setLayout(l); | 300 | frame->setLayout(l); | ||
300 | } | 301 | } | ||
301 | 302 | | |||
302 | QObject::connect(frame, SIGNAL(dropped(QDropEvent*,QWidget*)), panel, SLOT(handleDrop(QDropEvent*))); | 303 | QObject::connect(frame, &ListPanelFrame::dropped, panel, [=](QDropEvent *event) { dynamic_cast<ListPanel*>(panel)->handleDrop(event); }); | ||
303 | if(!color.isEmpty()) | 304 | if(!color.isEmpty()) | ||
304 | QObject::connect(panel, SIGNAL(refreshColors(bool)), frame, SLOT(refreshColors(bool))); | 305 | QObject::connect(dynamic_cast<ListPanel*>(panel), QOverload<bool>::of(&ListPanel::refreshColors), dynamic_cast<ListPanelFrame*>(frame), &ListPanelFrame::refreshColors); | ||
abika: And here, too: please change the type of `frame` to `ListPanelFrame` and `panel` to `ListPanel`. | |||||
Panel to ListPanel is not so strait forward. It forces dynamic cast at KrLayoutFactory constructor: KrLayoutFactory(QWidget *panel, QHash<QString, QWidget*> &widgets) : panel(panel), widgets(widgets) {} So I won't change it mchabrecek: Panel to ListPanel is not so strait forward. It forces dynamic cast at KrLayoutFactory… | |||||
305 | 306 | | |||
306 | return frame; | 307 | return frame; | ||
307 | } | 308 | } |
And here, too: please change the type of frame to ListPanelFrame and panel to ListPanel.