Merge branch 'master' into mart/ToolTipArea
This commit is contained in:
commit
b54b42fcc0
@ -46,7 +46,7 @@ find_package(Qt5 REQUIRED NO_MODULE COMPONENTS Quick X11Extras Sql UiTools Qml W
|
|||||||
find_package(KF5 CONFIG REQUIRED IdleTime ItemModels WidgetsAddons WindowSystem Codecs Archive CoreAddons Solid ThreadWeaver GlobalAccel
|
find_package(KF5 CONFIG REQUIRED IdleTime ItemModels WidgetsAddons WindowSystem Codecs Archive CoreAddons Solid ThreadWeaver GlobalAccel
|
||||||
Config Auth JS Wallet DBusAddons I18n GuiAddons ConfigWidgets
|
Config Auth JS Wallet DBusAddons I18n GuiAddons ConfigWidgets
|
||||||
Service ItemViews Notifications IconThemes Completion JobWidgets Sonnet TextWidgets XmlGui Crash
|
Service ItemViews Notifications IconThemes Completion JobWidgets Sonnet TextWidgets XmlGui Crash
|
||||||
Bookmarks Declarative UnitConversion Parts Kross KIO DNSSD KDE4Support)
|
Bookmarks Declarative UnitConversion Parts Kross KIO DNSSD)
|
||||||
|
|
||||||
|
|
||||||
find_package(KActivities 5.0.0 CONFIG REQUIRED)
|
find_package(KActivities 5.0.0 CONFIG REQUIRED)
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
[Desktop Entry]
|
[Desktop Entry]
|
||||||
Comment=Example applet that shows how to use Models embedded in DataEngines
|
Comment=Example applet that shows how to use Models embedded in DataEngines
|
||||||
|
Comment[de]=Miniprogramm-Beispiel, das die Anwendung von Modellen eingebettet in Datenquellen zeigt
|
||||||
Comment[nl]=Voorbeeld van applet dat toont hoe modellen ingebed in gegevensengines zijn te gebruiken
|
Comment[nl]=Voorbeeld van applet dat toont hoe modellen ingebed in gegevensengines zijn te gebruiken
|
||||||
Comment[pt]=Uma 'applet' de exemplo que demonstra como usar os modelos incorporados em motores de dados
|
Comment[pt]=Uma 'applet' de exemplo que demonstra como usar os modelos incorporados em motores de dados
|
||||||
Comment[pt_BR]=Uma miniaplicativo de exemplo que mostra como usar os modelos integrados em mecanismos de dados
|
Comment[pt_BR]=Uma miniaplicativo de exemplo que mostra como usar os modelos integrados em mecanismos de dados
|
||||||
|
@ -134,7 +134,6 @@ void DialogProxy::onVisibleChanged()
|
|||||||
if (geometry() != screen()->availableGeometry()) {
|
if (geometry() != screen()->availableGeometry()) {
|
||||||
m_cachedGeometry = geometry();
|
m_cachedGeometry = geometry();
|
||||||
}
|
}
|
||||||
setPosition(screen()->availableGeometry().topLeft());
|
|
||||||
setGeometry(screen()->availableGeometry());
|
setGeometry(screen()->availableGeometry());
|
||||||
} else {
|
} else {
|
||||||
if (!m_cachedGeometry.isNull()) {
|
if (!m_cachedGeometry.isNull()) {
|
||||||
@ -412,8 +411,6 @@ void DialogProxy::syncBorders()
|
|||||||
{
|
{
|
||||||
const QRect avail = screen()->availableGeometry();
|
const QRect avail = screen()->availableGeometry();
|
||||||
|
|
||||||
m_frameSvgItem->setEnabledBorders(Plasma::FrameSvg::AllBorders);
|
|
||||||
|
|
||||||
int borders = Plasma::FrameSvg::AllBorders;
|
int borders = Plasma::FrameSvg::AllBorders;
|
||||||
|
|
||||||
//Tooltips always have all the borders
|
//Tooltips always have all the borders
|
||||||
|
@ -0,0 +1,83 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2014 David Edmundson <davidedmundson@kde.org>
|
||||||
|
*
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
import org.kde.plasma.components 2.0 as PlasmaComponents
|
||||||
|
|
||||||
|
import QtQuick 2.0
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A ModelMenu creates a context menu with items populated from a model or a QList<QAction*>
|
||||||
|
* For standard item models, actions are created using the following model role names or properties
|
||||||
|
* display - a string contains the action name
|
||||||
|
* decoration - an icon to display
|
||||||
|
* separator - boolean that will add a seperator in the list
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* Example code:
|
||||||
|
*
|
||||||
|
* @code
|
||||||
|
* ModelMenu {
|
||||||
|
* id: menu
|
||||||
|
* visualParent: someButton
|
||||||
|
* model: myModel
|
||||||
|
* }
|
||||||
|
*
|
||||||
|
* Button {
|
||||||
|
* id: someButton
|
||||||
|
* onClicked: menu.popup()
|
||||||
|
* }
|
||||||
|
* @endcode
|
||||||
|
*/
|
||||||
|
|
||||||
|
PlasmaComponents.ContextMenu {
|
||||||
|
id: menu
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The model containing menu items
|
||||||
|
*/
|
||||||
|
property alias model: repeater.model
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This signal is emitted when a menu item is clicked.
|
||||||
|
* The attached model properties for that menu item are passed as an argument
|
||||||
|
*/
|
||||||
|
signal clicked(QtObject model)
|
||||||
|
|
||||||
|
//ContextMenu cannot have child items, so in order to have ContextMenu as the root object of this item
|
||||||
|
//we create a new property which contains an item which can then load the child items
|
||||||
|
property Item _children : Item {
|
||||||
|
Repeater {
|
||||||
|
id: repeater
|
||||||
|
delegate: PlasmaComponents.MenuItem {
|
||||||
|
//for QList<QAction*> Repeater adds an attached property modelData
|
||||||
|
//for QAbstractItemModel* it doesn't. Not checking causes errors
|
||||||
|
text: typeof(modelData) != "undefined" ? modelData.text : model.display
|
||||||
|
icon: typeof(modelData) != "undefined" ? modelData.icon : model.decoration
|
||||||
|
separator: typeof(modelData) != "undefined" ? modelData.separator : model.separator
|
||||||
|
onClicked: {
|
||||||
|
menu.clicked(typeof(modelData) != "undefined" ? modelData : model)
|
||||||
|
}
|
||||||
|
Component.onCompleted: {
|
||||||
|
parent = menu
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -13,6 +13,7 @@ Dialog 2.0 Dialog.qml
|
|||||||
Highlight 2.0 Highlight.qml
|
Highlight 2.0 Highlight.qml
|
||||||
Label 2.0 Label.qml
|
Label 2.0 Label.qml
|
||||||
ListItem 2.0 ListItem.qml
|
ListItem 2.0 ListItem.qml
|
||||||
|
ModelContextMenu 2.0 ModelContextMenu.qml
|
||||||
Page 2.0 Page.qml
|
Page 2.0 Page.qml
|
||||||
PageStack 2.0 PageStack.qml
|
PageStack 2.0 PageStack.qml
|
||||||
ProgressBar 2.0 ProgressBar.qml
|
ProgressBar 2.0 ProgressBar.qml
|
||||||
|
@ -148,7 +148,6 @@ PRIVATE
|
|||||||
KF5::XmlGui
|
KF5::XmlGui
|
||||||
KF5::GlobalAccel
|
KF5::GlobalAccel
|
||||||
KF5::DNSSD
|
KF5::DNSSD
|
||||||
KF5::KDE4Support #ksharedptr
|
|
||||||
${PLASMA_EXTRA_LIBS}
|
${PLASMA_EXTRA_LIBS}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -21,21 +21,19 @@
|
|||||||
#define PLASMA_SVG_P_H
|
#define PLASMA_SVG_P_H
|
||||||
|
|
||||||
#include <QHash>
|
#include <QHash>
|
||||||
#include <QSharedData>
|
#include <QSharedPointer>
|
||||||
#include <QSvgRenderer>
|
#include <QSvgRenderer>
|
||||||
|
#include <QWeakPointer>
|
||||||
#include "ksharedptr.h"
|
|
||||||
|
|
||||||
namespace Plasma
|
namespace Plasma
|
||||||
{
|
{
|
||||||
|
|
||||||
class Svg;
|
class Svg;
|
||||||
|
|
||||||
class SharedSvgRenderer : public QSvgRenderer, public QSharedData
|
class SharedSvgRenderer : public QSvgRenderer
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
typedef KSharedPtr<SharedSvgRenderer> Ptr;
|
typedef QSharedPointer<SharedSvgRenderer> Ptr;
|
||||||
|
|
||||||
SharedSvgRenderer(QObject *parent = 0);
|
SharedSvgRenderer(QObject *parent = 0);
|
||||||
SharedSvgRenderer(
|
SharedSvgRenderer(
|
||||||
const QString &filename,
|
const QString &filename,
|
||||||
@ -94,7 +92,7 @@ public:
|
|||||||
void themeChanged();
|
void themeChanged();
|
||||||
void colorsChanged();
|
void colorsChanged();
|
||||||
|
|
||||||
static QHash<QString, SharedSvgRenderer::Ptr> s_renderers;
|
static QHash<QString, QWeakPointer<SharedSvgRenderer> > s_renderers;
|
||||||
static QWeakPointer<Theme> s_systemColorsCache;
|
static QWeakPointer<Theme> s_systemColorsCache;
|
||||||
|
|
||||||
Svg *q;
|
Svg *q;
|
||||||
|
@ -36,7 +36,6 @@
|
|||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <kfilterdev.h>
|
#include <kfilterdev.h>
|
||||||
#include <kiconeffect.h>
|
#include <kiconeffect.h>
|
||||||
#include <ksharedptr.h>
|
|
||||||
|
|
||||||
#include "applet.h"
|
#include "applet.h"
|
||||||
#include "package.h"
|
#include "package.h"
|
||||||
@ -419,17 +418,15 @@ void SvgPrivate::createRenderer()
|
|||||||
QString styleSheet = cacheAndColorsTheme()->d->svgStyleSheet();
|
QString styleSheet = cacheAndColorsTheme()->d->svgStyleSheet();
|
||||||
styleCrc = qChecksum(styleSheet.toUtf8(), styleSheet.size());
|
styleCrc = qChecksum(styleSheet.toUtf8(), styleSheet.size());
|
||||||
|
|
||||||
QHash<QString, SharedSvgRenderer::Ptr>::const_iterator it = s_renderers.constFind(styleCrc + path);
|
QHash<QString, QWeakPointer<SharedSvgRenderer> >::const_iterator it = s_renderers.constFind(styleCrc + path);
|
||||||
|
|
||||||
if (it != s_renderers.constEnd()) {
|
renderer = it == s_renderers.constEnd() ? QWeakPointer<SharedSvgRenderer>() : it.value();
|
||||||
//qDebug() << "gots us an existing one!";
|
if (!renderer) {
|
||||||
renderer = it.value();
|
|
||||||
} else {
|
|
||||||
if (path.isEmpty()) {
|
if (path.isEmpty()) {
|
||||||
renderer = new SharedSvgRenderer();
|
renderer.reset(new SharedSvgRenderer());
|
||||||
} else {
|
} else {
|
||||||
QHash<QString, QRectF> interestingElements;
|
QHash<QString, QRectF> interestingElements;
|
||||||
renderer = new SharedSvgRenderer(path, styleSheet, interestingElements);
|
renderer.reset(new SharedSvgRenderer(path, styleSheet, interestingElements));
|
||||||
|
|
||||||
// Add interesting elements to the theme's rect cache.
|
// Add interesting elements to the theme's rect cache.
|
||||||
QHashIterator<QString, QRectF> i(interestingElements);
|
QHashIterator<QString, QRectF> i(interestingElements);
|
||||||
@ -455,16 +452,15 @@ void SvgPrivate::createRenderer()
|
|||||||
|
|
||||||
void SvgPrivate::eraseRenderer()
|
void SvgPrivate::eraseRenderer()
|
||||||
{
|
{
|
||||||
if (renderer && renderer.count() == 2) {
|
if (renderer) {
|
||||||
// this and the cache reference it
|
QWeakPointer<SharedSvgRenderer> guard = renderer;
|
||||||
s_renderers.erase(s_renderers.find(styleCrc + path));
|
renderer.reset();
|
||||||
|
if (guard.isNull() && theme) {
|
||||||
if (theme) {
|
// no SvgPrivate instance references this anymore
|
||||||
theme.data()->releaseRectsCache(path);
|
theme.data()->releaseRectsCache(path);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
renderer = 0;
|
|
||||||
styleCrc = 0;
|
styleCrc = 0;
|
||||||
localRectCache.clear();
|
localRectCache.clear();
|
||||||
elementsWithSizeHints.clear();
|
elementsWithSizeHints.clear();
|
||||||
@ -646,7 +642,7 @@ void SvgPrivate::colorsChanged()
|
|||||||
emit q->repaintNeeded();
|
emit q->repaintNeeded();
|
||||||
}
|
}
|
||||||
|
|
||||||
QHash<QString, SharedSvgRenderer::Ptr> SvgPrivate::s_renderers;
|
QHash<QString, QWeakPointer<SharedSvgRenderer> > SvgPrivate::s_renderers;
|
||||||
QWeakPointer<Theme> SvgPrivate::s_systemColorsCache;
|
QWeakPointer<Theme> SvgPrivate::s_systemColorsCache;
|
||||||
|
|
||||||
Svg::Svg(QObject *parent)
|
Svg::Svg(QObject *parent)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user