mirror of
https://bitbucket.org/smil3y/kdelibs.git
synced 2025-02-23 18:32:49 +00:00
plasma: new Plasma::ListWidget class
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
parent
06d8b39d5c
commit
ca3e34f47c
7 changed files with 131 additions and 12 deletions
|
@ -461,6 +461,7 @@ install(
|
|||
Plasma/ToolTipContent
|
||||
Plasma/ToolTipManager
|
||||
Plasma/TreeWidget
|
||||
Plasma/ListWidget
|
||||
Plasma/CalendarWidget
|
||||
Plasma/View
|
||||
Plasma/Wallpaper
|
||||
|
|
1
includes/Plasma/ListWidget
Normal file
1
includes/Plasma/ListWidget
Normal file
|
@ -0,0 +1 @@
|
|||
#include "../../plasma/widgets/listwidget.h"
|
|
@ -87,6 +87,7 @@ set(plasma_LIB_SRCS
|
|||
widgets/tabbar.cpp
|
||||
widgets/textbrowser.cpp
|
||||
widgets/treewidget.cpp
|
||||
widgets/listwidget.cpp
|
||||
widgets/textedit.cpp
|
||||
widgets/calendarwidget.cpp
|
||||
)
|
||||
|
@ -190,6 +191,7 @@ install(
|
|||
widgets/tabbar.h
|
||||
widgets/textbrowser.h
|
||||
widgets/treewidget.h
|
||||
widgets/listwidget.h
|
||||
widgets/textedit.h
|
||||
widgets/calendarwidget.h
|
||||
DESTINATION ${KDE4_INCLUDE_INSTALL_DIR}/plasma/widgets
|
||||
|
|
64
plasma/widgets/listwidget.cpp
Normal file
64
plasma/widgets/listwidget.cpp
Normal file
|
@ -0,0 +1,64 @@
|
|||
/*
|
||||
* Copyright 2024 Ivailo Monev <xakepa10@gmail.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Library General Public License as
|
||||
* published by the Free Software Foundation; either version 2, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this program; if not, write to the
|
||||
* Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#include "listwidget.h"
|
||||
#include "private/style_p.h"
|
||||
|
||||
#include <QListWidget>
|
||||
#include <QScrollBar>
|
||||
|
||||
namespace Plasma
|
||||
{
|
||||
|
||||
class ListWidgetPrivate
|
||||
{
|
||||
public:
|
||||
Plasma::Style::Ptr style;
|
||||
};
|
||||
|
||||
ListWidget::ListWidget(QGraphicsWidget *parent)
|
||||
: QGraphicsProxyWidget(parent),
|
||||
d(new ListWidgetPrivate())
|
||||
{
|
||||
QListWidget *native = new QListWidget();
|
||||
setWidget(native);
|
||||
native->setWindowIcon(QIcon());
|
||||
native->setAttribute(Qt::WA_NoSystemBackground);
|
||||
native->setFrameStyle(QFrame::NoFrame);
|
||||
|
||||
d->style = Plasma::Style::sharedStyle();
|
||||
native->verticalScrollBar()->setStyle(d->style.data());
|
||||
native->horizontalScrollBar()->setStyle(d->style.data());
|
||||
}
|
||||
|
||||
ListWidget::~ListWidget()
|
||||
{
|
||||
delete d;
|
||||
Plasma::Style::doneWithSharedStyle();
|
||||
}
|
||||
|
||||
QListWidget* ListWidget::nativeWidget() const
|
||||
{
|
||||
return static_cast<QListWidget*>(widget());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#include "moc_listwidget.cpp"
|
||||
|
56
plasma/widgets/listwidget.h
Normal file
56
plasma/widgets/listwidget.h
Normal file
|
@ -0,0 +1,56 @@
|
|||
/*
|
||||
* Copyright 2024 Ivailo Monev <xakepa10@gmail.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Library General Public License as
|
||||
* published by the Free Software Foundation; either version 2, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details
|
||||
*
|
||||
* You should have received a copy of the GNU Library General Public
|
||||
* License along with this program; if not, write to the
|
||||
* Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#ifndef PLASMA_LISTWIDGET_H
|
||||
#define PLASMA_LISTWIDGET_H
|
||||
|
||||
#include <QGraphicsProxyWidget>
|
||||
#include <QListWidget>
|
||||
|
||||
#include <plasma/plasma_export.h>
|
||||
|
||||
namespace Plasma
|
||||
{
|
||||
|
||||
class ListWidgetPrivate;
|
||||
|
||||
/**
|
||||
* @class ListWidget plasma/widgets/listwidget.h <Plasma/Widgets/ListWidget>
|
||||
*
|
||||
* @short Provides a plasma-themed QListWidget.
|
||||
*/
|
||||
class PLASMA_EXPORT ListWidget : public QGraphicsProxyWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit ListWidget(QGraphicsWidget *parent = nullptr);
|
||||
~ListWidget();
|
||||
|
||||
/**
|
||||
* @return the native widget wrapped by this ListWidget
|
||||
*/
|
||||
QListWidget* nativeWidget() const;
|
||||
|
||||
private:
|
||||
ListWidgetPrivate *const d;
|
||||
};
|
||||
|
||||
}
|
||||
#endif // multiple inclusion guard
|
|
@ -18,14 +18,11 @@
|
|||
*/
|
||||
|
||||
#include "treewidget.h"
|
||||
#include "private/style_p.h"
|
||||
|
||||
#include <QTreeWidget>
|
||||
#include <QScrollBar>
|
||||
|
||||
#include <kiconloader.h>
|
||||
|
||||
#include "private/style_p.h"
|
||||
|
||||
namespace Plasma
|
||||
{
|
||||
|
||||
|
@ -37,7 +34,7 @@ public:
|
|||
|
||||
TreeWidget::TreeWidget(QGraphicsWidget *parent)
|
||||
: QGraphicsProxyWidget(parent),
|
||||
d(new TreeWidgetPrivate)
|
||||
d(new TreeWidgetPrivate())
|
||||
{
|
||||
QTreeWidget *native = new QTreeWidget();
|
||||
setWidget(native);
|
||||
|
@ -56,7 +53,7 @@ TreeWidget::~TreeWidget()
|
|||
Plasma::Style::doneWithSharedStyle();
|
||||
}
|
||||
|
||||
QTreeWidget *TreeWidget::nativeWidget() const
|
||||
QTreeWidget* TreeWidget::nativeWidget() const
|
||||
{
|
||||
return static_cast<QTreeWidget*>(widget());
|
||||
}
|
||||
|
|
|
@ -20,13 +20,11 @@
|
|||
#ifndef PLASMA_TREEWIDGET_H
|
||||
#define PLASMA_TREEWIDGET_H
|
||||
|
||||
#include <QtGui/QGraphicsProxyWidget>
|
||||
#include <QGraphicsProxyWidget>
|
||||
#include <QTreeWidget>
|
||||
|
||||
#include <plasma/plasma_export.h>
|
||||
|
||||
#include <QTreeWidget>
|
||||
#include <QAbstractItemModel>
|
||||
|
||||
namespace Plasma
|
||||
{
|
||||
|
||||
|
@ -42,13 +40,13 @@ class PLASMA_EXPORT TreeWidget : public QGraphicsProxyWidget
|
|||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit TreeWidget(QGraphicsWidget *parent = 0);
|
||||
explicit TreeWidget(QGraphicsWidget *parent = nullptr);
|
||||
~TreeWidget();
|
||||
|
||||
/**
|
||||
* @return the native widget wrapped by this TreeWidget
|
||||
*/
|
||||
QTreeWidget *nativeWidget() const;
|
||||
QTreeWidget* nativeWidget() const;
|
||||
|
||||
private:
|
||||
TreeWidgetPrivate *const d;
|
||||
|
|
Loading…
Add table
Reference in a new issue