Counter::Counter(QWidget *parent)
	: QWidget(parent)
{
	// Initialize private data members
	countDisplay = new QLabel(this);
	count = new QPushButton("Click", this);
	quit = new QPushButton("Quit", this);
	layout = new QVBoxLayout;
	counter = 0;

	// Add widgets to the layout
	layout->addWidget(count);
	layout->addWidget(countDisplay);
	layout->addWidget(quit);

	// Create the layout
	setLayout(layout);

	// Set up the connections between different pieces of the app. These
	// connections tell the app to call certain functions when certain events
	// occur. Look up doc on signals and slots if this is confusing.
	QObject::connect(count, SIGNAL(clicked()), this, SLOT(showCount()));
	QObject::connect(quit, SIGNAL(clicked()), this, SLOT(quitClicked()));

	// Show the initial count before we show the app window. If this happens
	// after we call show(), then there is no value displayed initially.
	showCount();

	// Show the app window.
	show();
}
Example #2
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)));
}
Example #3
0
void tst_QTimer::recurringTimer()
{
    const int target = 5;
    QFETCH(int, interval);

    {
        RecurringTimerObject object(target);
        QObject::connect(&object, SIGNAL(done()), &QTestEventLoop::instance(), SLOT(exitLoop()));
        (void) object.startTimer(interval);
        QTestEventLoop::instance().enterLoop(5);

        QCOMPARE(object.times, target);
    }

    {
        // make sure that eventloop recursion doesn't effect timer recurrance
        RecurringTimerObject object(target);
        object.recurse = true;

        QObject::connect(&object, SIGNAL(done()), &QTestEventLoop::instance(), SLOT(exitLoop()));
        (void) object.startTimer(interval);
        QTestEventLoop::instance().enterLoop(5);

        QCOMPARE(object.times, target);
    }
}
Example #4
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 #5
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 #6
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 #7
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();
    }
SignalSlotDialog::SignalSlotDialog(QDesignerDialogGuiInterface *dialogGui, QWidget *parent, FocusMode mode) :
    QDialog(parent),
    m_focusMode(mode),
    m_ui(new Ui::SignalSlotDialogClass),
    m_dialogGui(dialogGui)
{
    setModal(true);
    m_ui->setupUi(this);

    const QIcon plusIcon = qdesigner_internal::createIconSet(QString::fromUtf8("plus.png"));
    const QIcon minusIcon = qdesigner_internal::createIconSet(QString::fromUtf8("minus.png"));
    m_ui->addSlotButton->setIcon(plusIcon);
    m_ui->removeSlotButton->setIcon(minusIcon);
    m_ui->addSignalButton->setIcon(plusIcon);
    m_ui->removeSignalButton->setIcon(minusIcon);

    m_slotPanel = new SignaturePanel(this, m_ui->slotListView, m_ui->addSlotButton, m_ui->removeSlotButton, QLatin1String("slot"));
    m_signalPanel = new SignaturePanel(this, m_ui->signalListView, m_ui->addSignalButton, m_ui->removeSignalButton, QLatin1String("signal"));
    connect(m_slotPanel,   SIGNAL(checkSignature(QString,bool*)), this, SLOT(slotCheckSignature(QString,bool*)));
    connect(m_signalPanel, SIGNAL(checkSignature(QString,bool*)), this, SLOT(slotCheckSignature(QString,bool*)));

    connect(m_ui->buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
    connect(m_ui->buttonBox, SIGNAL(rejected()), this, SLOT(reject()));

    switch(m_focusMode) {
    case FocusSlots:
        m_ui->slotListView->setFocus(Qt::OtherFocusReason);
        break;
    case  FocusSignals:
        m_ui->signalListView->setFocus(Qt::OtherFocusReason);
        break;
    }
}
Example #9
0
Robot::Robot() 
{
    m_pArm = new Arm();
    m_pCamera = new Camera();

    logInit();
    // Generated RobotContext
    m_pRobotContext = new RobotContext(*m_pCamera, *m_pArm);
    m_pRobotContext->SetObserver(SmQtObserver::GetInstance());
    QObject::connect(m_pRobotContext,
                     SIGNAL(end()),
                     this,
                     SLOT(contextEnd()));

    QObject::connect(m_pArm,
                     SIGNAL(calibrationDone()),
                     m_pRobotContext,
                     SLOT(evArmCalibrationDone()));

    QObject::connect(m_pCamera,
                     SIGNAL(calibrationDone()),
                     m_pRobotContext,
                     SLOT(evCameraCalibrationDone()));

}
Example #10
0
static SendCoinsRecipient handleRequest(PaymentServer* server, std::vector<unsigned char>& data)
{
    RecipientCatcher sigCatcher;
    QObject::connect(server, SIGNAL(receivedPaymentRequest(SendCoinsRecipient)),
        &sigCatcher, SLOT(getRecipient(SendCoinsRecipient)));

    // Write data to a temp file:
    QTemporaryFile f;
    f.open();
    f.write((const char*)data.data(), data.size());
    f.close();

    // Create a QObject, install event filter from PaymentServer
    // and send a file open event to the object
    QObject object;
    object.installEventFilter(server);
    QFileOpenEvent event(f.fileName());
    // If sending the event fails, this will cause sigCatcher to be empty,
    // which will lead to a test failure anyway.
    QCoreApplication::sendEvent(&object, &event);

    QObject::disconnect(server, SIGNAL(receivedPaymentRequest(SendCoinsRecipient)),
        &sigCatcher, SLOT(getRecipient(SendCoinsRecipient)));

    // Return results from sigCatcher
    return sigCatcher.recipient;
}
Example #11
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 #12
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 #13
0
bool MjpegClient::connectTo(const QString& host, int port, QString url, const QString& user, const QString& pass)
{
    if(url.isEmpty())
        url = "/";

    m_host = host;
    m_port = port > 0 ? port : 80;
    m_url = url;
    m_user = user;
    m_pass = pass;

    if(m_socket)
    {
        m_socket->abort();
        delete m_socket;
        m_socket = 0;
    }

    m_socket = new QTcpSocket(this);
    connect(m_socket, SIGNAL(readyRead()),    this,   SLOT(dataReady()));
    connect(m_socket, SIGNAL(disconnected()), this,   SLOT(lostConnection()));
    connect(m_socket, SIGNAL(disconnected()), this, SIGNAL(socketDisconnected()));
    connect(m_socket, SIGNAL(connected()),    this, SIGNAL(socketConnected()));
    connect(m_socket, SIGNAL(connected()),    this,   SLOT(connectionReady()));
    connect(m_socket, SIGNAL(error(QAbstractSocket::SocketError)), this, SIGNAL(socketError(QAbstractSocket::SocketError)));
    connect(m_socket, SIGNAL(error(QAbstractSocket::SocketError)), this, SLOT(lostConnection(QAbstractSocket::SocketError)));

    m_socket->connectToHost(host,port);
    m_socket->setReadBufferSize(1024 * 1024);

    return true;
}
Example #14
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 #15
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);
    }
}
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 #17
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 #18
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 #19
0
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 #20
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;

}
Example #21
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 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();
}
Example #23
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 #24
0
void SaweTestClass::
        project(Sawe::pProject p)
{
    if (!project_.expired())
    {
        Sawe::pProject oldp = project();
        if (oldp)
        {
            disconnect( oldp->tools().render_view(), SIGNAL(postPaint()), this, SLOT(postPaint()));
            disconnect( oldp->tools().render_view(), SIGNAL(finishedWorkSection()), this, SLOT(renderViewFinishedWorkSection()));
        }
    }
    else
    {
        // Close any other project currently open by the application
        // (application_cmd_options.cpp opens a project by default, but that
        // might not be the project we want to run in the current test)
        Sawe::Application* app = Sawe::Application::global_ptr ();
        std::set<boost::weak_ptr<Sawe::Project>> projects = app->projects ();
        for (boost::weak_ptr<Sawe::Project> wp : projects) {
            Sawe::pProject pl = wp.lock ();
            if (pl && pl != p) {
                TaskTimer tt("Closing previous project");
                app->slotClosed_window( pl->mainWindow () );
            }
        }
    }

    project_ = p;
    project_is_opened_ = false;

    QVERIFY( p.get() );

    connect( p->tools().render_view(), SIGNAL(postPaint()), this, SLOT(postPaint()), Qt::QueuedConnection);
}
Example #25
0
void Rack::add(RackElement* re) {

	// empty user name?
	if (re->getUserName().empty()) {re->setUserName(re->getProductString());}

	// ensure the element provides an unique name
	if (hasElementNamed(re->getUserName())) {

		// create a unique name
		std::string name = "";
		for (unsigned int i = 1; i < 64; ++i) {
			name = re->getProductString() + " " + std::to_string(i);
			if (!hasElementNamed(name)) {break;}
		}
		re->setUserName(name);

	}

	// add to gui
	rw.add(re);

	// add to list
	elems.push_back(re);

	// user name changed -> rack changed
	connect(re, SIGNAL(userNameChanged()), this, SIGNAL(onRackChanged()));

	// attach
	re->onRackAttach();

	//emit entryAdded( (unsigned int) elems.size() - 1);
	emit onRackChanged();

}
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 #27
0
AutoDock::AutoDock(SysLogParser *parser, FemtoTester *tester, QObject *parent) :
    QObject(parent),
    m_parser(parser),
    m_tester(tester),
    m_dockingState(DockingStateMessage::DockedManually),
    m_softDockingLimits(0, 0),
    m_regularDockingLimits(0, 0),
    m_zeroDockingLimits(0, 0),
    m_dockingMode(ManualDocking),
    m_slots(),
    m_currentSlot(0),
    m_targetSlot(0),
    m_servoSpeedUp(0),
    m_servoSpeedDown(0),
    m_zForce(0),
    m_forceIsSteady(false),
    m_autoDock(false),
    m_autoUndock(false),
    m_autoSlotSelect(false)
{
    loadSettings();
    connect(tester, SIGNAL(connectedStateChanged(bool)), this, SLOT(loadHwSettings()));
    connect(tester, SIGNAL(dockingForceChanged(qreal,bool)), this, SLOT(setDockingForce(qreal,bool)));
    connect(tester, SIGNAL(settingsByteChanged(quint8,quint8)), this, SLOT(onHwByteSettingChanged(quint8,quint8)));
    connect(tester, SIGNAL(settingsWordChanged(quint8,quint16)), this, SLOT(onHwWordSettingChanged(quint8,quint16)));
    connect(tester, SIGNAL(settingsArrayChanged(quint8,QByteArray)), this, SLOT(onHwArraySettingChanged(quint8,QByteArray)));
    connect(tester, SIGNAL(dockingStateChanged(DockingStateMessage::DockingState)), this, SLOT(onDockingStateChange(DockingStateMessage::DockingState)));
    connect(tester, SIGNAL(dockingStateChanged(DockingStateMessage::DockingState)), this, SIGNAL(dockingStateChanged(DockingStateMessage::DockingState)));
    connect(m_parser, SIGNAL(dockingModeSelected(AutoDock::DockingMode)), this, SLOT(setDockingMode(AutoDock::DockingMode)));
    connect(m_parser, SIGNAL(suctionRingVacuumDisabled()), this, SLOT(onTreatmentFinished()));
    connect(m_parser, SIGNAL(treatmentAborted()), this, SLOT(onTreatmentFinished()));
    connect(m_parser, SIGNAL(dmsSensorReset()), this, SLOT(undock()));
    connect(m_parser, SIGNAL(treatmentStarted()), this, SLOT(stop())); // lock when treatment starts
}
Example #28
0
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()));
}
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);
}
void PropertyGridContainerWidget::ConnectToSignals()
{
    connect(PropertiesGridController::Instance(), SIGNAL(PropertiesGridUpdated()),
            this, SLOT(OnPropertiesGridUpdated()));
    connect(PropertiesGridController::Instance(), SIGNAL(UIControlsDeselected()),
            this, SLOT(OnUIControlsDeselected()));
}