コード例 #1
0
SelectResourceImage::SelectResourceImage(const QString &directory, QWidget *parent, const QString& pathPrefix) :
    QFDialog(parent),
    ui(new Ui::SelectResourceImage)
{
    ui->setupUi(this);
    connect(ui->treeView, SIGNAL(clicked(QModelIndex)), this, SLOT(treeClicked(QModelIndex)));
    connect(ui->listView, SIGNAL(doubleClicked(QModelIndex)), this, SLOT(listDoubleClicked(QModelIndex)));


    QStandardItem *parentItem = model.invisibleRootItem();
    listDirectory(QDir(directory), parentItem, pathPrefix);
    ui->treeView->setModel(&model);
    ui->listView->setModel(&model);
    ui->listView->setRootIndex(model.index(0,0));
    ui->spinIconSize->setValue(16);


    isMulti=false;
    ProgramOptions::getConfigWindowGeometry(this, "SelectResourceImage/window");
    ProgramOptions::getConfigQSplitter(ui->splitter, "SelectResourceImage/splitter");
    ProgramOptions::getConfigQSpinBox(ui->spinIconSize, "SelectResourceImage/spinIconSize");
    ProgramOptions::getConfigQToolButton(ui->btnLarge, "SelectResourceImage/btnLarge");
    ProgramOptions::getConfigQToolButton(ui->btnList, "SelectResourceImage/btnList");
    ProgramOptions::getConfigQToolButton(ui->btnTreeOnly, "SelectResourceImage/btnTreeOnly");
    updateView();
    setWindowFlags(windowFlags()|Qt::WindowMinMaxButtonsHint);
}
コード例 #2
0
void CommunicationTree::mousePressEvent(QMouseEvent *event) {
    QTreeView::mousePressEvent(event);

    if (event->buttons() == Qt::LeftButton) {
        emit treeClicked(currentIndex());
    }
}
コード例 #3
0
SelectResourceImage::SelectResourceImage(const QStringList &directories, QWidget *parent, const QStringList &pathPrefixes, const QStringList &baseNodeNames) :
    QFDialog(parent),
    ui(new Ui::SelectResourceImage)
{
    ui->setupUi(this);
    connect(ui->treeView, SIGNAL(clicked(QModelIndex)), this, SLOT(treeClicked(QModelIndex)));
    connect(ui->listView, SIGNAL(doubleClicked(QModelIndex)), this, SLOT(listDoubleClicked(QModelIndex)));


    if (baseNodeNames.isEmpty()) {
        QStandardItem *parentItem = model.invisibleRootItem();
        for (int i=0; i<directories.size(); i++) {
            listDirectory(QDir(directories[i]), parentItem, pathPrefixes.value(i, ""));
        }
    } else {
        QStandardItem *inv = model.invisibleRootItem();
        for (int i=0; i<directories.size(); i++) {
            QStandardItem *parentItem=new QStandardItem(baseNodeNames.value(i, tr("group %1").arg(i+1)));
            parentItem->setData(false, Qt::UserRole+2);
            parentItem->setData(QDir(directories[i]).absolutePath());
            inv->appendRow(parentItem);
            listDirectory(QDir(directories[i]), parentItem, pathPrefixes.value(i, ""));
        }
    }
    ui->treeView->setModel(&model);
    ui->listView->setModel(&model);
    ui->listView->setRootIndex(model.index(0,0));
    ui->btnLarge->setChecked(true);
    ui->spinIconSize->setValue(64);


    isMulti=true;
    ProgramOptions::getConfigWindowGeometry(this, "SelectResourceImageMulti/window");
    ProgramOptions::getConfigQSplitter(ui->splitter, "SelectResourceImageMulti/splitter");
    ProgramOptions::getConfigQSpinBox(ui->spinIconSize, "SelectResourceImageMulti/spinIconSize");
    ProgramOptions::getConfigQToolButton(ui->btnLarge, "SelectResourceImageMulti/btnLarge");
    ProgramOptions::getConfigQToolButton(ui->btnList, "SelectResourceImageMulti/btnList");
    ProgramOptions::getConfigQToolButton(ui->btnTreeOnly, "SelectResourceImageMulti/btnTreeOnly");
    updateView();
    setWindowFlags(windowFlags()|Qt::WindowMinMaxButtonsHint);
}
コード例 #4
0
/**
 * Constructor.
 * @param parent   the parent (wizard) of this wizard page
 */
CodeImpSelectPage::CodeImpSelectPage(QWidget *parent)
  : QWizardPage(parent),
    m_fileList(),
    m_fileExtensions()
{
    setTitle(i18n("Code Importing Path"));
    setSubTitle(i18n("Select the code importing path."));

    setupUi(this);

    setupLanguageBox();
    connect(ui_languageBox, SIGNAL(activated(int)), this, SLOT(languageChanged(int)));
    connect(this, SIGNAL(languageChanged()), this, SLOT(changeLanguage()));

    setupTreeView();
    connect(ui_treeView, SIGNAL(clicked(QModelIndex)), this, SLOT(treeClicked(QModelIndex)));

    setupFileExtEdit();
    connect(ui_fileExtLineEdit, SIGNAL(editingFinished()), this, SLOT(fileExtChanged()));

    setupToolTips();
    // update file extensions
    changeLanguage();
}