Example #1
0
CSVWorld::NestedTable::NestedTable(CSMDoc::Document& document,
                                   CSMWorld::UniversalId id,
                                   CSMWorld::NestedTableProxyModel* model,
                                   QWidget* parent,
                                   bool editable,
                                   bool fixedRows)
    : DragRecordTable(document, parent),
      mAddNewRowAction(NULL),
      mRemoveRowAction(NULL),
      mEditIdAction(NULL),
      mModel(model)
{
    mDispatcher = new CSMWorld::CommandDispatcher (document, id, this);

    setSelectionBehavior (QAbstractItemView::SelectRows);
    setSelectionMode (QAbstractItemView::ExtendedSelection);

#if QT_VERSION >= QT_VERSION_CHECK(5,0,0)
    horizontalHeader()->setSectionResizeMode (QHeaderView::Interactive);
#else
    horizontalHeader()->setResizeMode (QHeaderView::Interactive);
#endif
    verticalHeader()->hide();

    int columns = model->columnCount(QModelIndex());

    for(int i = 0 ; i < columns; ++i)
    {
        CSMWorld::ColumnBase::Display display = static_cast<CSMWorld::ColumnBase::Display> (
            model->headerData (i, Qt::Horizontal, CSMWorld::ColumnBase::Role_Display).toInt());

        CommandDelegate *delegate = CommandDelegateFactoryCollection::get().makeDelegate(display,
                                                                                         mDispatcher,
                                                                                         document,
                                                                                         this);

        setItemDelegateForColumn(i, delegate);
    }

    setModel(model);

    if (editable)
    {
        if (!fixedRows)
        {
            mAddNewRowAction = new QAction (tr ("Add new row"), this);

            connect(mAddNewRowAction, SIGNAL(triggered()),
                    this, SLOT(addNewRowActionTriggered()));

            mRemoveRowAction = new QAction (tr ("Remove row"), this);

            connect(mRemoveRowAction, SIGNAL(triggered()),
                    this, SLOT(removeRowActionTriggered()));
        }

        mEditIdAction = new TableEditIdAction(*this, this);
        connect(mEditIdAction, SIGNAL(triggered()), this, SLOT(editCell()));
    }
}
Example #2
0
void AgrosSolver::runSuite()
{
    // log stdout
    if (m_enableLog)
         m_log = new LogStdOut();

    // silent mode
    setSilentMode(true);

    connect(currentPythonEngineAgros(), SIGNAL(pythonShowMessage(QString)), this, SLOT(stdOut(QString)));
    connect(currentPythonEngineAgros(), SIGNAL(pythonShowHtml(QString)), this, SLOT(stdHtml(QString)));

    QString testSuite = QString("from test_suite.scenario import run_suite; run_suite(test_suite.test_%1)").arg(m_suiteName);
    qDebug() << testSuite;

    bool successfulRun= currentPythonEngineAgros()->runScript(testSuite);

    if (successfulRun)
    {
        Agros2D::scene()->clear();
        Agros2D::clear();
        QApplication::exit(0);
    }
    else
    {
        ErrorResult result = currentPythonEngineAgros()->parseError();
        Agros2D::log()->printMessage(tr("Scripting Engine"), tr("%1\nLine: %2\nStacktrace:\n%3\n").
                                  arg(result.error()).
                                  arg(result.line()).
                                  arg(result.traceback()));

        QApplication::exit(-1);
    }
}
Example #3
0
void widget::createSystemTrayIcon()
{
    trayIcon = new QSystemTrayIcon(this);
    trayIcon->setIcon(QIcon(tr(":/images/myIcon.ico")));
    trayIcon->setToolTip("阁楼音乐 - 音乐播放器");

    restoreAction = new QAction(tr("打开主面板"), this);
    connect(restoreAction, SIGNAL(triggered()), this, SLOT(show()));

    quitAction=new QAction(tr("退出"), this);
    connect(quitAction, SIGNAL(triggered()), qApp, SLOT(quit()));

    trayContextMenu=new QMenu(this);
    playModeMenu->setTitle("播放模式");
    trayContextMenu->addMenu(playModeMenu);
    trayContextMenu->addSeparator();
    trayContextMenu->addAction(ui->action_About);
    trayContextMenu->addSeparator();
    trayContextMenu->addAction(restoreAction);
    trayContextMenu->addAction(quitAction);
    trayIcon->setContextMenu(trayContextMenu);

    trayIcon->show();
    connect(trayIcon, SIGNAL(activated(QSystemTrayIcon::ActivationReason)), \
            this, SLOT(iconActivated(QSystemTrayIcon::ActivationReason)));
}
void DocumentModel::addEntry(Entry *entry)
{
    QString fileName = entry->fileName();

    // replace a non-loaded entry (aka 'restored') if possible
    int previousIndex = indexOfFilePath(fileName);
    if (previousIndex >= 0) {
        if (entry->document && d->m_documents.at(previousIndex)->document == 0) {
            Entry *previousEntry = d->m_documents.at(previousIndex);
            d->m_documents[previousIndex] = entry;
            delete previousEntry;
            connect(entry->document, SIGNAL(changed()), this, SLOT(itemChanged()));
        } else {
            delete entry;
        }
        return;
    }

    int index;
    QString displayName = entry->displayName();
    for (index = 0; index < d->m_documents.count(); ++index) {
        if (displayName < d->m_documents.at(index)->displayName())
            break;
    }
    int row = index + 1/*<no document>*/;
    beginInsertRows(QModelIndex(), row, row);
    d->m_documents.insert(index, entry);
    if (entry->document)
        connect(entry->document, SIGNAL(changed()), this, SLOT(itemChanged()));
    endInsertRows();
}
Example #5
0
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    conta_pacote=0;

    ui->setupUi(this);
    ui->Plot_Window->setRenderHint(QPainter::HighQualityAntialiasing);
    ui->Plot_Window->scale(2,2);

    Address_Transmit = QHostAddress("10.0.27.67");
    Address_Receive = QHostAddress("10.0.27.52");
    Address_Multicast = QHostAddress("224.0.0.1");

    udpSocket = new QUdpSocket(this);
    udpSocket->bind(Address_Receive,COMPORT, QUdpSocket::ShareAddress);
    connect(udpSocket,SIGNAL(readyRead()),this,SLOT(readPendingDatagrams()));

    udpSocketimagem = new QUdpSocket(this);
    udpSocketimagem->bind(Address_Multicast,DATAPORT, QUdpSocket::ShareAddress);
    udpSocketimagem->joinMulticastGroup(Address_Multicast);
    connect(udpSocketimagem,SIGNAL(readyRead()),this,SLOT(readPendingData()));

    setWindowTitle(tr("Morpheus"));
    resize(1240, 800);

    ui->tabWidget->setCurrentIndex(0);

    read_omr();
}
void TcDownload::StartDownload(const QUrl &url,
                             QFile *file,
                             qint64 startPoint/* =0 */,
                             qint64 endPoint/* =-1 */)
{
    if( NULL == file )
        return;

    m_HaveDoneBytes = 0;
    m_StartPoint = startPoint;
    m_EndPoint = endPoint;
    m_File = file;

    //根据HTTP协议,写入RANGE头部,说明请求文件的范围
    QNetworkRequest qheader;
    qheader.setUrl(url);
    QString range;
    range.sprintf("Bytes=%lld-%lld", m_StartPoint, m_EndPoint);
    qheader.setRawHeader("Range", range.toLocal8Bit());

    //开始下载
    m_Reply = m_Qnam.get(QNetworkRequest(qheader));
    connect(m_Reply, SIGNAL(finished()), this, SLOT(FinishedSlot()));
    connect(m_Reply, SIGNAL(readyRead()), this, SLOT(HttpReadyRead()));
}
Example #7
0
SpawnModel::SpawnModel(Player* player, QObject *parent)
    : QAbstractTableModel(parent), m_player(player)
{
    connect(m_player, SIGNAL(posChanged(int16_t,int16_t,int16_t, int16_t,int16_t,int16_t,int32_t)),
            this, SLOT(updatePosition(int16_t,int16_t,int16_t, int16_t,int16_t,int16_t,int32_t)));
    connect(m_player, SIGNAL(levelChanged(uint8_t)), this, SLOT(updateLevel(uint8_t)));
}
Example #8
0
Window::Window()
{
    QGridLayout *mainLayout = new QGridLayout;

    for (int i = 0; i < NumRows; ++i) {
        for (int j = 0; j < NumColumns; ++j) {
            QColor clearColor;
            clearColor.setHsv(((i * NumColumns) + j) * 255
                              / (NumRows * NumColumns - 1),
                              255, 63);

            glWidgets[i][j] = new GLWidget(0, 0);
            glWidgets[i][j]->setClearColor(clearColor);
            glWidgets[i][j]->rotateBy(+42 * 16, +42 * 16, -21 * 16);
            mainLayout->addWidget(glWidgets[i][j], i, j);

            connect(glWidgets[i][j], SIGNAL(clicked()),
                    this, SLOT(setCurrentGlWidget()));
        }
    }
    setLayout(mainLayout);

    currentGlWidget = glWidgets[0][0];

    QTimer *timer = new QTimer(this);
    connect(timer, SIGNAL(timeout()), this, SLOT(rotateOneStep()));
    timer->start(20);

    setWindowTitle(tr("Textures"));
}
Example #9
0
void ThreadedAssignment::commonInit(const QString& targetName, NodeType_t nodeType, bool shouldSendStats) {
    // change the logging target name while the assignment is running
    LogHandler::getInstance().setTargetName(targetName);
    
    NodeList* nodeList = NodeList::getInstance();
    nodeList->setOwnerType(nodeType);
    
    // this is a temp fix for Qt 5.3 - rebinding the node socket gives us readyRead for the socket on this thread
    nodeList->rebindNodeSocket();
    
    QTimer* domainServerTimer = new QTimer(this);
    connect(domainServerTimer, SIGNAL(timeout()), this, SLOT(checkInWithDomainServerOrExit()));
    domainServerTimer->start(DOMAIN_SERVER_CHECK_IN_MSECS);
    
    QTimer* silentNodeRemovalTimer = new QTimer(this);
    connect(silentNodeRemovalTimer, SIGNAL(timeout()), nodeList, SLOT(removeSilentNodes()));
    silentNodeRemovalTimer->start(NODE_SILENCE_THRESHOLD_MSECS);
    
    if (shouldSendStats) {
        // send a stats packet every 1 second
        QTimer* statsTimer = new QTimer(this);
        connect(statsTimer, &QTimer::timeout, this, &ThreadedAssignment::sendStatsPacket);
        statsTimer->start(1000);
    }
}
Example #10
0
CurveletGUI::CurveletGUI(QWidget *parent)
: QMainWindow(parent)
{
	this->resize(800,600);
	this->FileListView = new QListWidget;
	this->FileListView->isSortingEnabled();
	this->setCentralWidget(this->FileListView);
	this->InputFileList.clear();
	QToolBar * mainToolBar = new QToolBar(this);

	this->exitAction = new QAction(tr("Exit"), this);
	connect(this->exitAction, SIGNAL(triggered()), this, SLOT(close()));
	this->exitAction->setShortcut(QKeySequence::Close);
	this->menuBar()->addAction(this->exitAction);

	this->loadImages = new QAction("Load Images", this);
	connect(this->loadImages, SIGNAL(triggered()), this, SLOT(BrowseFiles()));
	this->menuBar()->addAction(this->loadImages);

	this->ProcessImages = new QAction("Run Curvelets on Images", this);
	connect(this->ProcessImages, SIGNAL(triggered()), this, SLOT(ProcessFiles()));
	this->ProcessImages->setEnabled(false);
	this->menuBar()->addAction(this->ProcessImages);

	this->SigmaValue = new QDoubleSpinBox(this);
	this->SigmaValue->setRange(0,1);
	this->SigmaValue->setValue(.03);
	this->SigmaValue->setSingleStep(.01);
	mainToolBar->addWidget(new QLabel("Sigma Value: "));
	mainToolBar->addWidget(this->SigmaValue);
	this->addToolBar(mainToolBar);
}
void    DataSource::operateWorker( QObject* worker )
{
    Q_ASSERT( worker != nullptr && "qps::DataSource::operateWorker(): can't operate a nullptr worker object" );

    connect( this, SIGNAL( operate() ), worker, SLOT( operate() ) );
    if ( isAsynchronous( ) ) {
        if ( _workerThread != nullptr ) {   // An existing running thread is destroyed to force a clean new one creation
            _workerThread->quit( );
            _workerThread->wait( );
            _workerThread->deleteLater( );
            _workerThread = nullptr;
        }
        if ( _workerThread == nullptr )
            _workerThread = new QThread( this );

        if ( _workerThread != nullptr ) {
            worker->moveToThread( _workerThread );
            connect( _workerThread, &QThread::finished, worker, &QObject::deleteLater );
            _workerThread->start( );
            emit operate( );
        }
    }
    else
        emit operate( );
}
Example #12
0
void MainWindow::setSynergyState(qSynergyState state)
{
    if (synergyState() == state)
        return;

    if (state == synergyConnected)
    {
        disconnect (m_pButtonToggleStart, SIGNAL(clicked()), m_pActionStartSynergy, SLOT(trigger()));
        connect (m_pButtonToggleStart, SIGNAL(clicked()), m_pActionStopSynergy, SLOT(trigger()));
        m_pButtonToggleStart->setText(tr("&Stop"));
    }
    else
    {
        disconnect (m_pButtonToggleStart, SIGNAL(clicked()), m_pActionStopSynergy, SLOT(trigger()));
        connect (m_pButtonToggleStart, SIGNAL(clicked()), m_pActionStartSynergy, SLOT(trigger()));
        m_pButtonToggleStart->setText(tr("&Start"));
    }

    m_pGroupClient->setEnabled(state == synergyDisconnected);
    m_pGroupServer->setEnabled(state == synergyDisconnected);
    m_pActionStartSynergy->setEnabled(state == synergyDisconnected);
    m_pActionStopSynergy->setEnabled(state == synergyConnected);
    setStatus(state == synergyConnected ? QString(tr("Synergy %1 is running.")).arg(synergyType() == synergyServer ? tr("server") : tr("client")) : tr("Synergy is not running."));
    setIcon(state);
    m_SynergyState = state;
}
Example #13
0
QTextEdit * Editor::addEditor(const QString & name, const Effect * effect, int i)
{
    SourceEdit * textEdit = new SourceEdit(this);
    this->addTab(textEdit, name);
    textEdit->setFont(m_font);
    textEdit->setLineWrapMode(QTextEdit::NoWrap);
    textEdit->setTabStopWidth(28);
    textEdit->setAcceptRichText(false);

    QTextDocument * textDocument = textEdit->document();

    Highlighter * hl = new Highlighter(textDocument);
    hl->setRules(effect->factory()->highlightingRules());
    hl->setMultiLineCommentStart(effect->factory()->multiLineCommentStart());
    hl->setMultiLineCommentEnd(effect->factory()->multiLineCommentEnd());

    textEdit->setPlainText(effect->getInput(i));
    textDocument->setModified(false);

    connect(textEdit, SIGNAL(textChanged()), this, SIGNAL(textChanged()));
    connect(textEdit, SIGNAL(cursorPositionChanged()), this, SIGNAL(cursorPositionChanged()));
    connect(textDocument, SIGNAL(modificationChanged(bool)), this, SIGNAL(modifiedChanged(bool)));

    if (count() == 1) {
        emit onCurrentChanged(currentIndex());
    }

    return textEdit;
}
MatrixViewDialog::MatrixViewDialog(std::shared_ptr<Matrix<int>>& matrix, int pos, QWidget *parent) :
    QDialog(parent),
    ui(new Ui::MatrixViewDialog),
    data(matrix),
    _pos(pos)
{
    ui->setupUi(this);
    setWindowTitle(QString::fromStdString(matrix->toStr()) + " info");

    ui->tableWidget->setRowCount(matrix->rows());
    ui->tableWidget->setColumnCount(matrix->columns());
    ui->tableWidget->horizontalHeader()->setSectionResizeMode(QHeaderView::Stretch);
    ui->tableWidget->verticalHeader()->setSectionResizeMode(QHeaderView::Stretch);

    for (size_t i = 0; i < matrix->rows(); ++i) {
        for (size_t j = 0; j < matrix->columns(); ++j) {
            auto tmpItem = new QTableWidgetItem;

            auto tmpStr = QString::fromStdString(std::to_string((*matrix)(i,j)));
            tmpItem->setText(tmpStr);
            tmpItem->setTextAlignment(Qt::AlignCenter);
            ui->tableWidget->setItem(i, j, tmpItem);
        }
    }

    connect(ui->saveBtn, SIGNAL(clicked()), SLOT(saveBtnClicked()));
    connect(ui->removeBtn, SIGNAL(clicked()), SLOT(removeBtnClicked()));
}
void DeclarativeItemContainer::setDeclarativeItem(QDeclarativeItem *item, bool reparent)
{
    if (m_declarativeItem) {
        disconnect(m_declarativeItem.data(), 0, this, 0);
    }
    m_declarativeItem = item;
    if (reparent) {
        static_cast<QGraphicsItem *>(item)->setParentItem(this);
    }
    setMinimumWidth(item->implicitWidth());
    setMinimumHeight(item->implicitHeight());
    resize(item->width(), item->height());
    connect(m_declarativeItem.data(), SIGNAL(widthChanged()), this, SLOT(widthChanged()));
    connect(m_declarativeItem.data(), SIGNAL(heightChanged()), this, SLOT(heightChanged()));

    if (m_declarativeItem.data()->metaObject()->indexOfProperty("minimumWidth") >= 0) {
        QObject::connect(m_declarativeItem.data(), SIGNAL(minimumWidthChanged()), this, SLOT(minimumWidthChanged()));
    }

    if (m_declarativeItem.data()->metaObject()->indexOfProperty("minimumHeight") >= 0) {
        QObject::connect(m_declarativeItem.data(), SIGNAL(minimumHeightChanged()), this, SLOT(minimumHeightChanged()));
    }
    minimumWidthChanged();
    minimumHeightChanged();
}
void PropertyGridContainerWidget::ConnectToSignals()
{
    connect(PropertiesGridController::Instance(), SIGNAL(PropertiesGridUpdated()),
            this, SLOT(OnPropertiesGridUpdated()));
    connect(PropertiesGridController::Instance(), SIGNAL(UIControlsDeselected()),
            this, SLOT(OnUIControlsDeselected()));
}
SendMessagesDialog::SendMessagesDialog(Mode mode, Type type, QWidget *parent) :
    QDialog(parent),
    ui(new Ui::SendMessagesDialog),
    model(0),
    mode(mode),
    type(type)
{

    ui->setupUi(this);

#ifdef Q_OS_MAC // Icons on push buttons are very uncommon on Mac
    ui->addButton->setIcon(QIcon());
    ui->clearButton->setIcon(QIcon());
    ui->sendButton->setIcon(QIcon());
#endif

#if QT_VERSION >= 0x040700
     /* Do not move this to the XML file, Qt before 4.7 will choke on it */
    if(mode == SendMessagesDialog::Encrypted)
        ui->addressFrom->setPlaceholderText(tr("Enter a XAB address (e.g. Xefstsji9GL4oRtXNAPS7Aqer7uyVmc3qc)"));
 #endif
    addEntry();

    connect(ui->addButton, SIGNAL(clicked()), this, SLOT(addEntry()));
    connect(ui->clearButton, SIGNAL(clicked()), this, SLOT(clear()));
    connect(ui->closeButton, SIGNAL(clicked()), this, SLOT(reject()));

    fNewRecipientAllowed = true;

    if(mode == SendMessagesDialog::Anonymous)
        ui->frameAddressFrom->hide();

    if(type == SendMessagesDialog::Page)
        ui->closeButton->hide();
}
Example #18
0
/*
 * Constructor
 *
 * @param listView The list view to display packages
 * @param spinner The spinner to configure the number of archive to keep
 * @param refreshBtn The refresh view button
 * @param cleanBtn The clean button
 */
PackageGroupModel::PackageGroupModel(QString optionsString,
                                     QListWidget *listView,
                                     QSpinBox *spinner,
                                     QPushButton *refreshBtn,
                                     QPushButton *cleanBtn)
                                        : QObject(NULL),
                                        m_optionsString(optionsString), 
                                        m_listView(listView), 
                                        m_spinner(spinner), 
                                        m_refreshButton(refreshBtn),
                                        m_cleanButton(cleanBtn),
                                        m_cmd(new UnixCommand(this)),
                                        m_acc(new ProcessOutputAccumulator(m_cmd)),
                                        m_oldKeepValue(spinner->value())
{
  m_cleanButton->setText(tr("Clean"));

  //setup UI slots
  connect( m_spinner, SIGNAL( valueChanged(int) ), SLOT( updateKeepArchives() ) );
  connect( m_spinner, SIGNAL( valueChanged(int) ), SLOT( refreshCacheView() ) );
  connect( m_spinner, SIGNAL( editingFinished() ), SLOT( keepArchivesChanged() ) );
  connect( m_refreshButton, SIGNAL( clicked() ), SLOT( refreshCacheView() ) );
  connect( m_cleanButton, SIGNAL( clicked() ), SLOT( cleanCache() ) );

  isExecutingCommand = false;

  //refresh cache informations at startup
  refreshCacheView();
}
Example #19
0
void TcDownloadList::StartFileDownload(const QString &url, int count)
{
    m_DownloadCount = count;
    m_FinishedNum = 0;
    m_Url = QUrl(url);
    m_FileSize = GetFileSize(m_Url);
    //先获得文件的名字
    QFileInfo fileInfo(m_Url.path());
    QString fileName = fileInfo.fileName();
    if (fileName.isEmpty())
        fileName = "index.html";

    m_File->setFileName(fileName);
    //打开文件
    m_File->open(QIODevice::WriteOnly);
    TcDownload *tempDownload;

    //将文件分成PointCount段,用异步的方式下载
    //qDebug() << "Start download file from " << strUrl;
    for(int i=0; i<m_DownloadCount; i++)
    {
        //先算出每段的开头和结尾(HTTP协议所需要的信息)
        int start = m_FileSize * i / m_DownloadCount;
        int end = m_FileSize * (i+1) / m_DownloadCount;
        if( i != 0 )
            start--;

        //分段下载该文件
        tempDownload = new TcDownload(i + 1, this);
        connect(tempDownload, SIGNAL(DownloadFinished()), this, SLOT(SubPartFinished()));
        connect(tempDownload, SIGNAL(DownloadFinished()), tempDownload, SLOT(deleteLater()));
        tempDownload->StartDownload(m_Url, m_File, start, end);
    }
}
Example #20
0
QTitleWidget::QTitleWidget(QWidget *parent) :
    QWidget(parent)
{
    QHBoxLayout *hl = new QHBoxLayout;
    hl->setMargin(0);
    hl->setSpacing(0);
    setObjectName("titleWidget");
    QLabel * label = new QLabel;
    QImage image(":/inner/images/begin.png");
    label->setPixmap(QPixmap::fromImage(image));
    label->setFixedSize(16,16);
    QAction * ac = new QAction(QIcon(":/inner/images/delete_item.png"),tr("Remove Item"),this);
    m_delButton = new QToolBarButton(ac);
    ac = new QAction(QIcon(":/inner/images/add.png"),tr("Add Title"),this);
    m_addTitleButton = new QToolBarButton(ac);
    m_addTitleButton->setVisible(true);
    hl->addWidget(m_addTitleButton);
    hl->addWidget(label);
    hl->addSpacerItem(new QSpacerItem(1,1,QSizePolicy::Expanding,
                                      QSizePolicy::Expanding));
    hl->addWidget(m_delButton);
    setLayout(hl);

    setStyleSheet("#titleWidget{background-color:rgb(255,220,180);}");
    setFixedHeight(22);

    connect(m_addTitleButton,SIGNAL(clicked()),this,SIGNAL(addTitle()));
    connect(m_delButton,SIGNAL(clicked()),this,SIGNAL(delItem()));
}
Example #21
0
QLayout* DSceneNode::createContent()
{
    logMessage("DSceneNode::createContent()");

    txtPointX = new ValueLineEdit();
    txtPointY = new ValueLineEdit();
    connect(txtPointX, SIGNAL(editingFinished()), this, SLOT(doEditingFinished()));
    connect(txtPointY, SIGNAL(editingFinished()), this, SLOT(doEditingFinished()));
    connect(txtPointX, SIGNAL(evaluated(bool)), this, SLOT(evaluated(bool)));
    connect(txtPointY, SIGNAL(evaluated(bool)), this, SLOT(evaluated(bool)));
    lblDistance = new QLabel();
    lblAngle = new QLabel();

    // coordinates must be greater then or equal to 0 (axisymmetric case)
    if (Util::scene()->problemInfo()->problemType == ProblemType_Axisymmetric)
        txtPointX->setMinimum(0.0);

    QFormLayout *layout = new QFormLayout();
    layout->addRow(Util::scene()->problemInfo()->labelX() + " (m):", txtPointX);
    layout->addRow(Util::scene()->problemInfo()->labelY() + " (m):", txtPointY);
    layout->addRow(tr("Distance:"), lblDistance);
    layout->addRow(tr("Angle:"), lblAngle);

    return layout;
}
Example #22
0
DisplayWindow::DisplayWindow( QWidget* parent )
: QWidget(parent)
{
#ifndef RELEASE
    CallStackEntry entry("DisplayWindow::DisplayWindow");
#endif
    matrix_ = 0;

    // For the real matrix
    QHBoxLayout* matrixLayout = new QHBoxLayout();
    display_ = new DisplayWidget<double>();
    scroll_ = new QScrollArea();
    scroll_->setWidget( display_ );
    matrixLayout->addWidget( scroll_ );

    // Add two buttons at the bottom
    QHBoxLayout* buttonLayout = new QHBoxLayout();
    QPushButton* localButton = new QPushButton("Local");
    QPushButton* globalButton = new QPushButton("Global");
    buttonLayout->addWidget( localButton );
    buttonLayout->addWidget( globalButton );

    // Stack the matrix on top of the buttons
    QVBoxLayout* mainLayout = new QVBoxLayout();
    mainLayout->addLayout( matrixLayout );
    mainLayout->addLayout( buttonLayout );
    setLayout( mainLayout );

    connect( localButton, SIGNAL(clicked()), this, SLOT(UseLocalScale()) );
    connect( globalButton, SIGNAL(clicked()), this, SLOT(UseGlobalScale()) );
    setAttribute( Qt::WA_DeleteOnClose );

    // Elemental needs to know if a window was opened for cleanup purposes
    OpenedWindow();
}
Example #23
0
void SendCoinsDialog::setModel(WalletModel *model)
{
    this->model = model;

    for(int i = 0; i < ui->entries->count(); ++i)
    {
        SendCoinsEntry *entry = qobject_cast<SendCoinsEntry*>(ui->entries->itemAt(i)->widget());
        if(entry)
        {
            entry->setModel(model);
        }
    }
    if(model && model->getOptionsModel())
    {
        setBalance(model->getBalance(), model->getUnconfirmedBalance(), model->getImmatureBalance());
        connect(model, SIGNAL(balanceChanged(qint64, qint64, qint64)), this, SLOT(setBalance(qint64, qint64, qint64)));
        connect(model->getOptionsModel(), SIGNAL(displayUnitChanged(int)), this, SLOT(updateDisplayUnit()));

        // Coin Control
        connect(model->getOptionsModel(), SIGNAL(displayUnitChanged(int)), this, SLOT(coinControlUpdateLabels()));
        connect(model->getOptionsModel(), SIGNAL(coinControlFeaturesChanged(bool)), this, SLOT(coinControlFeatureChanged(bool)));
        connect(model->getOptionsModel(), SIGNAL(transactionFeeChanged(qint64)), this, SLOT(coinControlUpdateLabels()));
        ui->frameCoinControl->setVisible(model->getOptionsModel()->getCoinControlFeatures());
        coinControlUpdateLabels();
    }
void UIMachineWindowSeamless::prepareMiniToolbar()
{
    /* Get machine: */
    CMachine m = machine();

    /* Make sure mini-toolbar is necessary: */
    bool fIsActive = m.GetExtraData(GUI_ShowMiniToolBar) != "no";
    if (!fIsActive)
        return;

    /* Get the mini-toolbar alignment: */
    bool fIsAtTop = m.GetExtraData(GUI_MiniToolBarAlignment) == "top";
    /* Get the mini-toolbar auto-hide feature availability: */
    bool fIsAutoHide = m.GetExtraData(GUI_MiniToolBarAutoHide) != "off";
    /* Create mini-toolbar: */
    m_pMiniToolBar = new UIRuntimeMiniToolBar(this,
                                              fIsAtTop ? Qt::AlignTop : Qt::AlignBottom,
                                              IntegrationMode_External,
                                              fIsAutoHide);
    m_pMiniToolBar->show();
    QList<QMenu*> menus;
    QList<QAction*> actions = uisession()->newMenu()->actions();
    for (int i=0; i < actions.size(); ++i)
        menus << actions.at(i)->menu();
    m_pMiniToolBar->addMenus(menus);
    connect(m_pMiniToolBar, SIGNAL(sigMinimizeAction()), this, SLOT(showMinimized()));
    connect(m_pMiniToolBar, SIGNAL(sigExitAction()),
            gActionPool->action(UIActionIndexRuntime_Toggle_Seamless), SLOT(trigger()));
    connect(m_pMiniToolBar, SIGNAL(sigCloseAction()),
            gActionPool->action(UIActionIndexRuntime_Simple_Close), SLOT(trigger()));
}
Example #25
0
KisMouseInputEditor::KisMouseInputEditor(QWidget *parent)
    : KPushButton(parent), d(new Private)
{
    QWidget *popup = new QWidget();

    d->ui = new Ui::KisMouseInputEditor;
    d->ui->setupUi(popup);
    d->ui->mouseButton->setType(KisInputButton::MouseType);

    d->ui->clearModifiersButton->setIcon(KisIconUtils::loadIcon("edit-clear"));
    d->ui->clearMouseButton->setIcon(KisIconUtils::loadIcon("edit-clear"));

    QWidgetAction *action = new QWidgetAction(this);
    action->setDefaultWidget(popup);

    QMenu *menu = new QMenu(this);
    menu->addAction(action);
    setMenu(menu);

    QTimer::singleShot(0, this, SLOT(showMenu()));

    connect(d->ui->mouseButton, SIGNAL(dataChanged()), SLOT(updateLabel()));
    connect(d->ui->modifiersButton, SIGNAL(dataChanged()), SLOT(updateLabel()));
    connect(d->ui->clearMouseButton, SIGNAL(clicked(bool)), d->ui->mouseButton, SLOT(clear()));
    connect(d->ui->clearModifiersButton, SIGNAL(clicked(bool)), d->ui->modifiersButton, SLOT(clear()));
}
Example #26
0
ComSettings::ComSettings(QWidget *parent) : QWidget(parent)
{
	ui.setupUi(this);
	connect(ui.cancelPushButton,SIGNAL(clicked()),this,SIGNAL(cancelClicked()));
	connect(ui.savePushButton,SIGNAL(clicked()),this,SIGNAL(saveClicked()));
	connect(ui.datalogLocationBrowseButton,SIGNAL(clicked()),this,SLOT(browseLogFolderClicked()));
}
Example #27
0
void MainWindow::createMenu()
{
    addMenu = new QMenu(this);
    addMenu = this->menuBar()->addMenu(tr("添加"));
    addMemberAction = new QAction(tr("添加/修改家庭成员"),this);
    connect(addMemberAction,SIGNAL(triggered()),this,SLOT(addMember()));
    addMonthDefAction = new QAction(tr("添加/修改月固定支出"),this);
    connect(addMonthDefAction,SIGNAL(triggered()),this,SLOT(addMonthDef()));
    addMenu->addAction(addMemberAction);
    addMenu->addAction(addMonthDefAction);

    dataMenu = new QMenu(this);
    dataMenu = this->menuBar()->addMenu(tr("数据库管理"));
    backupAction = new QAction(tr("数据库备份"),this);
    connect(backupAction,SIGNAL(triggered()),this,SLOT(backup()));
    restoreAction = new QAction(tr("数据库还原"),this);
    connect(restoreAction,SIGNAL(triggered()),this,SLOT(restore()));
    dataMenu->addAction(backupAction);
    dataMenu->addAction(restoreAction);

    aboutMenu = new QMenu(this);
    aboutMenu = this->menuBar()->addMenu(tr("关于"));
    aboutAction = new QAction(tr("软件信息"),this);
    connect(aboutAction,SIGNAL(triggered()),this,SLOT(about()));
    aboutMenu->addAction(aboutAction);


}
Example #28
0
LogWindow::LogWindow(QWidget *parent, const char *name)
  : QDialog(parent, name, FALSE)
{
  setCaption(i18n("Info Window"));


  text_window = new myMultiEdit(this,"logwindow");
  text_window->setGeometry(2,5,500, 300);
  text_window->setFocusPolicy ( QWidget::NoFocus );


  dismiss = new QPushButton(this,"dismissbutton");
  dismiss->setGeometry(330,340,70,30);
  dismiss->setText(i18n("Dismiss"));

  connect(dismiss,SIGNAL(clicked()),SLOT(hideit()));
 
  stringlist = new QStrList(TRUE); // deep copies
  stringlist->setAutoDelete(TRUE);

  adjustSize();
  setMinimumSize(width(),height());
  
  sltimer = new QTimer(this);
  connect(sltimer,SIGNAL(timeout()),this,SLOT(updatewindow()));
  timerset = false;

}
void StaticPage::connectPages() {
    //Map the values of the navigation buttons with the indexes of
    //the stacked widget

    //Create a QMapper
    QSignalMapper *mapper = new QSignalMapper(this);

    //Connect the clicked signal with the QSignalMapper
    connect(ui->quickBtn, SIGNAL(clicked()), mapper, SLOT(map()));
    connect(ui->quickBackBtn, SIGNAL(clicked()), mapper, SLOT(map()));
    //connect(ui->quickUploadBtn, SIGNAL(clicked()), mapper, SLOT(map()));

    connect(ui->advBtn, SIGNAL(clicked()), mapper, SLOT(map()));
    connect(ui->advBackBtn, SIGNAL(clicked()), mapper, SLOT(map()));

    //Set a value for each button
    mapper->setMapping(ui->quickBtn, Page_Quick);
    mapper->setMapping(ui->quickBackBtn, Page_Base);
    //mapper->setMapping(ui->quickUploadBtn, Page_Upload);

    mapper->setMapping(ui->advBtn, Page_Advanced);
    mapper->setMapping(ui->advBackBtn, Page_Base);

    //Connect the mapper to the widget
    //The mapper will set a value to each button and
    //set that value to the widget
    //connect(pageMapper, SIGNAL(mapped(int)), this, SLOT(setCurrentIndex(int)));
    connect(mapper, SIGNAL(mapped(int)), this, SLOT(setCurrentPage(int)));

    //Set the current page
    m_currentPage = 0;
    setCurrentIndex(Page_Base);
}
Example #30
0
RestoDlg::RestoDlg(float valore, int durata, QWidget *parent) : QDialog(parent)
{
    setupUi(this);
    //setWindowFlags(Qt::Dialog|Qt::CustomizeWindowHint|Qt::WindowTitleHint);
    setWindowFlags(Qt::Tool);

    importoOrdine = valore;
    _durata = 1000 * durata;
    activateWindow();
    effetto = QSharedPointer<QPropertyAnimation>(new QPropertyAnimation(this, "windowOpacity"));

    if (_durata > 0) {
        connect(effetto.data(), SIGNAL(finished()), this, SLOT(close()));
        effetto->setStartValue("1");
        effetto->setEndValue("0");
        effetto->setDuration(_durata);
        effetto->setEasingCurve(QEasingCurve::InQuint);
        effetto->start();
    }

    setFocus();
    importoTxt->setText(QString("%L1").arg(importoOrdine, 4, 'f', 2));
    connect(importoRicevutoTxt, SIGNAL(textChanged(QString)), this, SLOT(ricalcolaResto()));
    ricalcolaResto();
}