mirror of
https://invent.kde.org/graphics/okular
synced 2024-07-05 00:58:46 +00:00
Show tool icons in the configuration widget
This commit is contained in:
parent
18981a6707
commit
36aca4403a
|
@ -30,6 +30,7 @@
|
|||
|
||||
#include "core/annotations.h"
|
||||
#include "ui/annotationwidgets.h"
|
||||
#include "ui/pageviewannotator.h"
|
||||
|
||||
// Used to store tools' XML description in m_list's items
|
||||
static const int ToolXmlRole = Qt::UserRole;
|
||||
|
@ -134,6 +135,7 @@ void WidgetAnnotTools::setTools(const QStringList& items)
|
|||
const QString itemText = toolElement.attribute( "name" );
|
||||
QListWidgetItem * listEntry = new QListWidgetItem( itemText, m_list );
|
||||
listEntry->setData( ToolXmlRole, qVariantFromValue(toolXml) );
|
||||
listEntry->setIcon( PageViewAnnotator::makeToolPixmap( toolElement ) );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -162,9 +164,14 @@ void WidgetAnnotTools::slotAdd( bool )
|
|||
if ( t.exec() != QDialog::Accepted )
|
||||
return;
|
||||
|
||||
QDomDocument entryParser;
|
||||
entryParser.setContent( t.toolXml() );
|
||||
QDomElement toolElement = entryParser.documentElement();
|
||||
|
||||
// Create list entry and attach XML string as data
|
||||
QListWidgetItem * listEntry = new QListWidgetItem( t.name(), m_list );
|
||||
listEntry->setData( ToolXmlRole, qVariantFromValue( t.toolXml() ) );
|
||||
listEntry->setData( ToolXmlRole, qVariantFromValue( entryParser.toString(-1) ) );
|
||||
listEntry->setIcon( PageViewAnnotator::makeToolPixmap( toolElement ) );
|
||||
|
||||
// Select and scroll
|
||||
m_list->setCurrentItem( listEntry );
|
||||
|
|
|
@ -77,13 +77,14 @@ class PageViewAnnotator : public QObject
|
|||
|
||||
void reparseConfig();
|
||||
|
||||
static QPixmap makeToolPixmap( const QDomElement &toolElement );
|
||||
|
||||
private slots:
|
||||
void slotToolSelected( int toolID );
|
||||
void slotSaveToolbarOrientation( int side );
|
||||
void slotToolDoubleClicked( int toolID );
|
||||
|
||||
private:
|
||||
static QPixmap makeToolPixmap( const QDomElement &toolElement );
|
||||
void detachAnnotation();
|
||||
|
||||
// global class pointers
|
||||
|
|
Loading…
Reference in New Issue
Block a user