42 #include "rendererWidget.hh" 51 RendererDialog::RendererDialog(QWidget *parent)
56 list->setContextMenuPolicy(Qt::CustomContextMenu);
58 connect(closeButton, SIGNAL(clicked()),
this, SLOT(accept()));
59 connect(list,SIGNAL(customContextMenuRequested(
const QPoint&)),
this,SLOT(slotContextMenu(
const QPoint&)));
62 QString iconPath = OpenFlipper::Options::iconDirStr()+OpenFlipper::Options::dirSeparator();
64 closeButton->setIcon( QIcon(iconPath +
"window-close.png"));
68 void RendererDialog::closeEvent(QCloseEvent *event)
75 void RendererDialog::showEvent ( QShowEvent * ) {
79 void RendererDialog::update()
84 for (
unsigned int i = 0 ; i < renderManager().
available() ; ++i) {
91 QFrame* frame =
new QFrame();
92 QHBoxLayout* hlayout =
new QHBoxLayout;
94 QLabel* name =
new QLabel( renderer->
name );
97 font.setPointSize(10);
99 QLabel* version =
new QLabel( renderer->
version );
100 hlayout->addWidget(name);
101 hlayout->addStretch();
102 hlayout->addWidget(version);
104 QVBoxLayout* vlayout =
new QVBoxLayout;
106 QLabel* description =
new QLabel( renderer->
description );
107 descriptions_.push_back(description);
109 vlayout->addLayout(hlayout,20);
110 vlayout->addWidget(description);
111 frame->setLayout(vlayout);
113 QListWidgetItem *item =
new QListWidgetItem(
"");
114 frames_.push_back(frame);
115 item->setSizeHint( QSize (100,50) );
118 list->setItemWidget(item, frame);
121 item->setBackground( Qt::green );
127 for (
int i=0; i < list->selectedItems().size(); ++i)
129 QListWidgetItem* widget = list->selectedItems()[i];
143 QMenu *menu =
new QMenu(list);
146 action = menu->addAction(tr(
"Activate"));
147 connect(action,SIGNAL(triggered(
bool)),
this,SLOT(slotActivateRenderer()));
150 menu->exec(list->mapToGlobal(_point),0);
QString name
Name of the plugin ( requested from the plugin on load)
void setActive(unsigned int _active, int _id)
set the active renderer
void slotActivateRenderer()
Activates the renderer (triggered via the context menu)
QString description
Description of the plugin ( requested from the plugin on load)
unsigned int activeExaminer()
Get the id of the examiner which got the last mouse events.
QString version
Version of the plugin ( requested from the plugin on load)
size_t available()
number of available renderers
void slotContextMenu(const QPoint &_point)
Show the custom context menu.