示例#1
0
SCgLayersWidget::SCgLayersWidget(SCgScene* scene, QWidget* parent)
    : QWidget(parent),
      mScene(scene)
{
    mToolBar = new QToolBar(this);
    mToolBar->addAction(QIcon(":/media/icons/add.png"), "Add layout", this, SLOT(createLayer()));
    mToolBar->addAction(QIcon(":/media/icons/remove.png"), "Delete layout", this, SLOT(deleteLayer()));
    mToolBar->addAction(QIcon(":/media/icons/enable.png"), "Show all", this, SLOT(showAll()));
    mToolBar->addAction(QIcon(":/media/icons/disable.png"), "Hide all", this, SLOT(hideAll()));

    mLayerListView = new QListWidget(this);
    mLayerListView->setSortingEnabled(true);
    mLayerListView->setSelectionMode(QAbstractItemView::ExtendedSelection);
    mLayerListView->setContextMenuPolicy(Qt::CustomContextMenu);

    QVBoxLayout* layout = new QVBoxLayout(this);
    layout->addWidget(mToolBar);
    layout->addWidget(mLayerListView);
    setLayout(layout);

    connect(mScene, SIGNAL(layerAdded(int,QString)), SLOT(addLayer(int,QString)));
    connect(mScene, SIGNAL(layerRemoved(int)), SLOT(removeLayer(int)));
    connect(mScene, SIGNAL(currentLayerChanged(int)), this, SLOT(selectLayer(int)));

    connect(mLayerListView, SIGNAL(customContextMenuRequested(QPoint)), SLOT(customContextMenu(QPoint)));
    connect(mLayerListView, SIGNAL(itemClicked(QListWidgetItem*)), SLOT(selectLayer(QListWidgetItem*)));
    connect(mLayerListView, SIGNAL(itemDoubleClicked(QListWidgetItem*)), SLOT(selectObjects()));
}
DatabaseListWidget::DatabaseListWidget(db::Connection *connection, QWidget *parent) :
	QDockWidget(tr("Databases"), parent), m_connection(connection)
{
	m_canswitch = connection->isCapable(db::Connection::SWITCH_DB);
	m_view = new QListWidget(this);
	m_view->setContextMenuPolicy(Qt::CustomContextMenu);
	connect(m_view, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(customContextMenu(QPoint)));
	connect(connection, &db::Connection::dbList, this, &DatabaseListWidget::refreshList);

	setWidget(m_view);
}
示例#3
0
FenetrePrincipale::FenetrePrincipale(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::FenetrePrincipale),projetPrinc(0),end(false)
{
    ui->setupUi(this);
    ui->mdiArea->setAttribute(Qt::WA_DeleteOnClose,false);
    ui->mdiArea->setDocumentMode(true);
    showMaximized();
    treeview=new QStandardItemModel();
    ui->treeView->setModel(treeview);
    ui->treeView->setContextMenuPolicy(Qt::CustomContextMenu);

    signalmapper=new QSignalMapper();

    QObject::connect(ui->treeView,SIGNAL(customContextMenuRequested(QPoint)),this,SLOT(customContextMenu(QPoint)));

    QObject::connect(ui->Arbre,SIGNAL(visibilityChanged(bool)),this,SLOT(triggerArbre(bool)));
    QObject::connect(ui->DocOuvert,SIGNAL(visibilityChanged(bool)),this,SLOT(triggerDocs(bool)));
    QObject::connect(ui->Compilation,SIGNAL(visibilityChanged(bool)),this,SLOT(triggerComp(bool)));
    QObject::connect(ui->Labels,SIGNAL(visibilityChanged(bool)),this,SLOT(triggerLabels(bool)));
    QObject::connect(ui->listWidget,SIGNAL(itemDoubleClicked(QListWidgetItem*)),this,SLOT(choose_sub_win(QListWidgetItem*)));
    QObject::connect(ui->actionFermer_le_projet,SIGNAL(triggered()),signalmapper,SLOT(map()));
    QObject::connect(signalmapper,SIGNAL(mapped(int)),this,SLOT(Fermerprojet(int)));
    signalmapper->setMapping(ui->actionFermer_le_projet,0);

    QObject::connect(ui->mdiArea,SIGNAL(subWindowActivated(QMdiSubWindow*)),this,SLOT(ChangerTitre(QMdiSubWindow*)));
}