Example #1
0
void WaitForWindowTest::testWaitEndedWithDefaultConstructor() {
    WaitForWindow waitForWindow;
    waitForWindow.setWindowObjectName("theName");
    waitForWindow.setActive(true);

    //WaitFor* must be registered in order to be used with QSignalSpy
    int waitForStarType = qRegisterMetaType<WaitFor*>("WaitFor*");
    QSignalSpy waitEndedSpy(&waitForWindow, SIGNAL(waitEnded(WaitFor*)));

    QWidget* otherWindow = new QWidget(mMainWindow);
    otherWindow->setObjectName("otherName");
    otherWindow->setWindowFlags(Qt::Window);
    otherWindow->show();

    otherWindow->deleteLater();

    QVERIFY(!waitForWindow.conditionMet());
    QCOMPARE(waitEndedSpy.count(), 0);

    QWidget* window = new QWidget(mMainWindow);
    window->setObjectName("theName");
    window->setWindowFlags(Qt::Window);
    window->show();

    window->deleteLater();

    QVERIFY(waitForWindow.conditionMet());
    QCOMPARE(waitEndedSpy.count(), 1);
    QVariant argument = waitEndedSpy.at(0).at(0);
    QCOMPARE(argument.userType(), waitForStarType);
    QCOMPARE(qvariant_cast<WaitFor*>(argument), &waitForWindow);
}
Example #2
0
// creation of a new capture in GUI mode
void Controller::startVisualCapture(const uint id, const QString &forcedSavePath) {
    if (!m_captureWindow) {
        QWidget *modalWidget = nullptr;
        do {
            modalWidget = qApp->activeModalWidget();
            if (modalWidget) {
                modalWidget->close();
                modalWidget->deleteLater();
            }
        } while (modalWidget);

        m_captureWindow = new CaptureWidget(id, forcedSavePath);
        //m_captureWindow = new CaptureWidget(id, forcedSavePath, false); // debug
        connect(m_captureWindow, &CaptureWidget::captureFailed,
                this, &Controller::captureFailed);
        connect(m_captureWindow, &CaptureWidget::captureTaken,
                this, &Controller::captureTaken);

#ifdef Q_OS_WIN
        m_captureWindow->show();
#else
        m_captureWindow->showFullScreen();
        //m_captureWindow->show(); // Debug
#endif
    } else {
        emit captureFailed(id);
    }
}
Example #3
0
void frmClients::initForm(WId w_ID,int fl){

    if (fl==1){
        ui->closeFrame->setHidden(true);
        ui->ClientTabs->setVisible(true);
        selClients = true;
    }
    else{
        ui->closeFrame->setVisible(true);
        ui->ClientTabs->setHidden(true);
        selClients = false;
    }

    if (w_ID != 0x0){
        QWidget *frm = find(w_ID);
        frm->deleteLater();
    }
    clSqlQueryModel *model = new clSqlQueryModel();
    model->setQuery("select FIO, nom_tel, DATE_R, ID, DEL, POL FROM clients");
    model->setHeaderData(0,Qt::Horizontal,QObject::tr("ФИО"));
    model->setHeaderData(1,Qt::Horizontal,QObject::tr("Тел."));
    model->setHeaderData(2,Qt::Horizontal,QObject::tr("Дата рожд."));
    model->setHeaderData(3,Qt::Horizontal,QObject::tr("ID"));
    model->setHeaderData(4,Qt::Horizontal,QObject::tr("DEL"));
    model->setHeaderData(5,Qt::Horizontal,QObject::tr("POL"));

    ui->tableView->setModel(model);
    ui->tableView->horizontalHeader()->setResizeMode(QHeaderView::Stretch);
    ui->tableView->setColumnHidden(3,true);
    ui->tableView->setColumnHidden(4,true);
    ui->tableView->setColumnHidden(5,true);
}
void BufferWidget::removeChatView(BufferId id) {
  QWidget *view = _chatViews.value(id, 0);
  if(!view) return;
  ui.stackedWidget->removeWidget(view);
  view->deleteLater();
  _chatViews.take(id);
}
Example #5
0
void TeamSelector::addTeam(Team* team)
{
  //FIXME: this fails if there is a team with the same port
  Session::getInstance().addTeamCommAgent(team);

  teams.push_back(team);
  teamsMap[team->number] = team;
  std::map<unsigned short, int>::iterator i = teamPages.find(team->number);
  TeamView* teamPage = new TeamView(this, team);
  int index = -1;
  if(i != teamPages.end())
  {
    index = i->second;
    QWidget* oldPage = widget(index);
    removeTab(index);
    oldPage->deleteLater();
    insertTab(index, teamPage, fromString("Team: "+team->name));
  }
  else
  {
    index = addTab(teamPage, fromString("Team: "+team->name));
  }
  teamViews[team->number] = teamPage;
  teamPages[team->number] = index;
}
Example #6
0
int ComboTabBar::insertTab(int index, const QIcon &icon, const QString &text, bool pinned)
{
    if (pinned) {
        index = m_pinnedTabBar->insertTab(index, icon, text);
    }
    else {
        index = m_mainTabBar->insertTab(index - pinnedTabsCount(), icon, text);

        if (tabsClosable()) {
            QWidget* closeButton = m_mainTabBar->tabButton(index, closeButtonPosition());
            if ((closeButton && closeButton->objectName() != QLatin1String("combotabbar_tabs_close_button")) || !closeButton) {
                // insert our close button
                insertCloseButton(index + pinnedTabsCount());
                if (closeButton) {
                    closeButton->deleteLater();
                }
            }
        }

        index += pinnedTabsCount();
    }

    updatePinnedTabBarVisibility();
    tabInserted(index);
    setMinimumWidths();

    return index;
}
void DolphinView::setMode(Mode mode)
{
    if (mode == m_mode) {
        return;         // the wished mode is already set
    }

    QWidget* view = (m_iconsView != 0) ? static_cast<QWidget*>(m_iconsView) :
                                         static_cast<QWidget*>(m_detailsView);
    if (view != 0) {
        m_topLayout->remove(view);
        view->close();
        view->deleteLater();
        m_iconsView = 0;
        m_detailsView = 0;
    }

    m_mode = mode;

    createView();

    ViewProperties props(m_urlNavigator->url());
    props.setViewMode(m_mode);

    emit signalModeChanged();
}
Example #8
0
void TabBar::setTabItemCount(const QString &tabName, const QString &itemCount)
{
    const int i = tabIndex(tabName, *this);
    if (i == -1)
        return;

    QWidget *tabCountLabel = tabButton(i, QTabBar::RightSide);

    if ( itemCount.isEmpty() ) {
        if (tabCountLabel) {
            tabCountLabel->deleteLater();
            setTabButton(i, QTabBar::RightSide, nullptr);
        }
    } else {
        if (!tabCountLabel) {
            tabCountLabel = new QLabel(this);
            tabCountLabel->setObjectName("tab_item_counter");
            setDefaultTabItemCounterStyle(tabCountLabel);
            setTabButton(i, QTabBar::RightSide, tabCountLabel);
        }

        tabCountLabel->setProperty("text", itemCount);
        tabCountLabel->adjustSize();
    }

    updateTabStyle(i);
}
Example #9
0
void ConfigObjectDialog::addHardwareParametersGroup(QLayout *parent) {
    list<SpmcPeripheral*> peripherals = object->getPeripherals();

    QVBoxLayout* layout = new QVBoxLayout();

    QWidget* widget = new QWidget();
    QFormLayout* paramsLayout = new QFormLayout();
    widget->setLayout(paramsLayout);
    QVBoxLayout* pinLayout = new QVBoxLayout();
    for (list<SpmcPeripheral*>::iterator i = peripherals.begin(); i != peripherals.end(); i++) {
        if (!((*i)->getParameters().empty())) {
            addParameters(paramsLayout, (*i)->getParameters());
        }
        map<string, list<PeripheralPort*> > ports = (*i)->getPorts();

        for (map<string, list<PeripheralPort*> >::iterator i = ports.begin(); i != ports.end(); i++) {
            addPortsGroup(pinLayout, i->first, i->second);
        }
    }
    addGroup(layout, "Pins", pinLayout);

    QWidget* tpWidget = new QWidget();
    QFormLayout* tpLayout = new QFormLayout();
    tpWidget->setLayout(tpLayout);
    addParameters(tpLayout, object->getTimestampPinParameters());
    pinLayout->addWidget(tpWidget);

    if (!paramsLayout->isEmpty()) {
        layout->insertWidget(0, widget);
    } else {
        widget->deleteLater();
    }

    addGroup(parent, "Hardware Parameter", layout);
}
Example #10
0
void MainWindow::setUpCleanupPage()
{
    for (int i = 0; i < m_ui.stackedWidget->count(); ++i) {
        QWidget *w = m_ui.stackedWidget->widget(i);
        m_ui.stackedWidget->removeWidget(w);
        w->deleteLater();
    }

    QVBoxLayout *lay = new QVBoxLayout;
    lay->addStretch();

    QLabel *logo = new QLabel();
    logo->setPixmap(KIcon("chakra-shiny").pixmap(128));
    lay->addWidget(logo);

    QLabel *l = new QLabel("Cleaning up...");
    lay->addWidget(l);

    lay->addStretch();

    QWidget *w = new QWidget;
    w->setLayout(lay);

    m_ui.stackedWidget->addWidget(w);

    m_ui.previousButton->setVisible(false);
    m_ui.nextButton->setVisible(false);
    m_ui.abortButton->setVisible(false);
}
Example #11
0
void DialogController::closeDialog()
{
    QWidget *dialog = m_dialog;
    m_dialog = nullptr;
    m_widget = nullptr;

    if(!dialog)
        return;

    QRect geom = dialog->geometry();
    int w = geom.width() + m_dialogOffsetLeft;
    QPropertyAnimation *animation  = new QPropertyAnimation(dialog, "geometry");
    animation->setStartValue(visibleGeometry(dialog));
    animation->setEndValue(hiddenGeometry(dialog));
    animation->setDuration(300);
    animation->setEasingCurve(QEasingCurve::OutExpo);
    animation->start();

    connect(animation, &QPropertyAnimation::finished, [=]{
        animation->deleteLater();
        dialog->close();
        dialog->deleteLater();
    });

    emit dialogClosed();
}
Example #12
0
WebView *TabWidget::webView(int index) const
{
    QWidget *widget = this->widget(index);
    if (WebViewWithSearch *webViewWithSearch = qobject_cast<WebViewWithSearch*>(widget)) {
        return webViewWithSearch->m_webView;
    } else if (widget) {
        // optimization to delay creating the first webview
        if (count() == 1) {
            TabWidget *that = const_cast<TabWidget*>(this);
            that->setUpdatesEnabled(false);
            LocationBar *currentLocationBar = qobject_cast<LocationBar*>(m_locationBars->widget(0));
            bool giveBackFocus = currentLocationBar->hasFocus();
            m_locationBars->removeWidget(currentLocationBar);
            m_locationBars->addWidget(new QWidget());
            that->newTab();
            that->closeTab(0);
            QWidget *newEmptyLineEdit = m_locationBars->widget(0);
            m_locationBars->removeWidget(newEmptyLineEdit);
            newEmptyLineEdit->deleteLater();
            m_locationBars->addWidget(currentLocationBar);
            currentLocationBar->setWebView(currentWebView());
            if (giveBackFocus)
                currentLocationBar->setFocus();
            that->setUpdatesEnabled(true);
            that->m_swappedDelayedWidget = true;
            return currentWebView();
        }
    }
    return 0;
}
Example #13
0
void PlotMarkerLegend::updateLegend(QwtLegend* legend) const
{
	if ( legend == NULL )
		return;

	if ( legend && testItemAttribute( QwtPlotItem::Legend ) && symbol() && symbol()->style() != QwtSymbol::NoSymbol )
	{
		QWidget *lgdItem = legend->find( this );
		if ( lgdItem == NULL )
		{
			lgdItem = legendItem();
			if ( lgdItem )
				legend->insert( this, lgdItem );
		}

		LegendItem *l = qobject_cast<LegendItem *>( lgdItem );
		if ( l )
			l->setIdentifierSize( symbol()->boundingSize() );
	}

	QWidget *lgdItem = legend->find( this );
	if ( testItemAttribute( QwtPlotItem::Legend ) )
	{
		LegendItem *label = qobject_cast<LegendItem *>( lgdItem );
		if ( label )
		{
			// paint the identifier
			const QSize sz = label->identifierSize();

			QPixmap identifier( sz.width(), sz.height() );
			identifier.fill( Qt::transparent );

			QPainter painter( &identifier );
			painter.setRenderHint( QPainter::Antialiasing, testRenderHint( QwtPlotItem::RenderAntialiased ) );
			drawLegendIdentifier( &painter, QRect( 0, 0, sz.width(), sz.height() ) );
			painter.end();

			const bool doUpdate = label->updatesEnabled();
			if ( doUpdate )
				label->setUpdatesEnabled( false );

			label->setText( title() );
			label->setIdentifier( identifier );
			label->setItemMode( legend->itemMode() );

			if ( doUpdate )
				label->setUpdatesEnabled( true );

			label->update();
		}
	}
	else
	{
		if ( lgdItem )
		{
			lgdItem->hide();
			lgdItem->deleteLater();
		}
	}
}
Example #14
0
void PopupChatWindow::tabCloseRequested(int tab)
{
    QWidget *widget = ui.tabWidget->widget(tab);

    if (widget) {
        widget->deleteLater();
    }
}
Example #15
0
void SidebarWidget::openPanel(const QString &identifier)
{
	QWidget *widget = NULL;

	if (identifier.isEmpty())
	{
		widget = NULL;
	}
	else if (identifier == QLatin1String("bookmarks") || identifier == QLatin1String("cache") || identifier == QLatin1String("config") || identifier == QLatin1String("cookies") || identifier == QLatin1String("history") || identifier == QLatin1String("transfers"))
	{
		Window *window = new Window(false, NULL, this);
		window->setUrl(QLatin1String("about:") + identifier, false);

		connect(window, SIGNAL(requestedOpenUrl(QUrl,OpenHints)), this, SLOT(openUrl(QUrl,OpenHints)));

		widget = window;
	}
	else if (identifier.startsWith(QLatin1String("web:")))
	{
		Window *window = new Window(false, NULL, this);
		window->setUrl(identifier.section(':', 1, -1));

		connect(window, SIGNAL(requestedOpenUrl(QUrl,OpenHints)), this, SLOT(openUrl(QUrl,OpenHints)));

		widget = window;
	}

	if (m_currentWidget)
	{
		QWidget *currentWidget = m_currentWidget;

		m_currentWidget = NULL;

		layout()->removeWidget(currentWidget);

		currentWidget->deleteLater();
	}

	if (m_buttons.contains(m_currentPanel) && m_buttons[m_currentPanel])
	{
		m_buttons[m_currentPanel]->setChecked(false);
	}

	if (widget)
	{
		layout()->addWidget(widget);

		if (m_buttons.contains(identifier) && m_buttons[identifier])
		{
			m_buttons[identifier]->setChecked(true);
		}
	}

	m_currentPanel = identifier;
	m_currentWidget = widget;

	updateSize();
}
Example #16
0
/*!
  \brief Update the entries for an item

  \param itemInfo Info for an item
  \param data List of legend entry attributes for the item
 */
void QwtLegend::updateLegend( const QVariant &itemInfo, 
    const QList<QwtLegendData> &data )
{
    QList<QWidget *> widgetList = legendWidgets( itemInfo );

    if ( widgetList.size() != data.size() )
    {
        QLayout *contentsLayout = d_data->view->contentsWidget->layout();

        while ( widgetList.size() > data.size() )
        {
            QWidget *w = widgetList.takeLast();

            contentsLayout->removeWidget( w );

            // updates might be triggered by signals from the legend widget
            // itself. So we better don't delete it here.

            w->hide();
            w->deleteLater();
        }

        for ( int i = widgetList.size(); i < data.size(); i++ )
        {
            QWidget *widget = createWidget( data[i] );

            if ( contentsLayout )
                contentsLayout->addWidget( widget );

            if ( isVisible() )
            {
                // QLayout does a delayed show, with the effect, that
                // the size hint will be wrong, when applications
                // call replot() right after changing the list
                // of plot items. So we better do the show now.

                widget->setVisible( true );
            }

            widgetList += widget;
        }

        if ( widgetList.isEmpty() )
        {
            d_data->itemMap.remove( itemInfo );
        }
        else
        {
            d_data->itemMap.insert( itemInfo, widgetList );
        }

        updateTabOrder();
    }
    
    for ( int i = 0; i < data.size(); i++ )
        updateWidget( widgetList[i], data[i] );
}
void AddLegacyAccountOptions::removeServiceButton(const Jid &AServiceJid)
{
	if (FWidgets.contains(AServiceJid))
	{
		QWidget *widget = FWidgets.take(AServiceJid);
		FLayout->removeWidget(widget);
		widget->deleteLater();
	}
}
Example #18
0
void BitcoinGUI::clearWidgets()
{
    centralStackedWidget->setCurrentWidget(centralStackedWidget->widget(0));
    for(int i = centralStackedWidget->count(); i>0; i--){
        QWidget* widget = centralStackedWidget->widget(i);
        centralStackedWidget->removeWidget(widget);
        widget->deleteLater();
    }
}
Example #19
0
void v3dDataFibers::generateThumbnails() const
{
    d->thumbnails.clear();

    // we must use a parent to prevent infinte recursion of the QVTKWidget
    // see: http://vtk.1045678.n5.nabble.com/qtimageviewer-example-crashes-with-vtk-5-6-0-td1249263.html
    //
    QWidget *parent = new QWidget;

    QVTKWidget *widget = new QVTKWidget (parent);
    QVBoxLayout *l = new QVBoxLayout(parent);
    l->setContentsMargins(0,0,0,0);
    l->addWidget(widget);


    vtkPolyDataMapper *mapper = vtkPolyDataMapper::New();
    vtkActor *actor = vtkActor::New();
    vtkRenderer *renderer = vtkRenderer::New();
    vtkRenderWindow *window = vtkRenderWindow::New();
    widget->SetRenderWindow(window);

    parent->setFixedSize(128,128);
    parent->show();

    mapper->SetInput (d->data->GetFibers());
    actor->SetMapper (mapper);
    renderer->AddViewProp(actor);
    window->SetSize (128,128);
    window->AddRenderer (renderer);
    //window->OffScreenRenderingOn();
    renderer->ResetCamera();

    //window->Render();
    parent->update();

    // make sure widget is shown and that openGL context is initialized
    // otherwise, an infinite loop happens when calling GetRGBACharPixelData
    qApp->processEvents();

    unsigned int w=128, h=128;
    d->thumbnail = QImage(w, h, QImage::Format_ARGB32);

    vtkUnsignedCharArray* pixels = vtkUnsignedCharArray::New();
    pixels->SetArray(d->thumbnail.bits(), w*h*4, 1);
    window->GetRGBACharPixelData(0, 0, w-1, h-1, 1, pixels);

    parent->hide();

    d->thumbnails.append (d->thumbnail);

    pixels->Delete();
    mapper->Delete();
    actor->Delete();
    renderer->Delete();
    window->Delete(); // crash if window is deleted
    parent->deleteLater();
}
void SeparateTerminal::closeTab(int index)
{
    QWidget *console = mTabWidget->widget(index);
    mTabWidget->removeTab(index);

    console->deleteLater();

    if (!mTabWidget->count())
        close();
}
Example #21
0
void MainWindow::on_actionConnect_triggered()
{
  ConnectDialog dialog(this);
  dialog.exec();

  if (dialog.result() == QDialog::Accepted) {
    if (m_session != NULL) {
      m_session->close();
      for (int i = m_ui.tabWidget->count() - 1; i > 1; i--) {
        QWidget *widget = m_ui.tabWidget->widget(i);
        m_ui.tabWidget->removeTab(i);
        widget->deleteLater();
      }
      disconnect(m_session, 0, 0, 0);
      disconnect(&inputHandler, 0, m_session, 0);
      m_session->deleteLater();
      m_session = NULL;
    }

    m_session = new Session(this);
    m_session->setHost(dialog.server());
    m_session->setPort(dialog.port());
    m_session->setUserName(dialog.username());
    m_session->setNickName(dialog.nickname());
    m_session->setRealName(dialog.realName());
    m_session->setNickPassword(dialog.nickPassword());
    if (dialog.useSsl()) {
      m_session->useSsl();
    }

    connect(m_session, SIGNAL(serverNumericMessageReceived(IrcNumericMessage *)),
        m_ui.serverTab, SLOT(numericMessageReceived(IrcNumericMessage *)));
    connect(m_session, SIGNAL(serverCapabilityMessageReceived(IrcCapabilityMessage *)),
        m_ui.serverTab, SLOT(capabilityMessageReceived(IrcCapabilityMessage *)));

    connect(m_session, SIGNAL(connecting()),
        m_ui.serverTab, SLOT(connecting()));
    connect(m_session, SIGNAL(connected()),
        m_ui.serverTab, SLOT(connected()));
    connect(m_session, SIGNAL(disconnected()),
        m_ui.serverTab, SLOT(disconnected()));
    connect(m_session, SIGNAL(channelJoined(Channel *)),
        this, SLOT(channelJoined(Channel *)));
    connect(m_session, SIGNAL(queryStarted(Query *)),
        this, SLOT(queryStarted(Query *)));

    connect(&inputHandler, SIGNAL(ircCommandReceived(IrcCommand *)),
        m_session, SLOT(handleCommand(IrcCommand *)));

    connect(m_session, SIGNAL(noticeMessageReceived(IrcNoticeMessage *)),
        this, SLOT(noticeMessageReceived(IrcNoticeMessage *)));

    m_session->open();
  }
}
void AbstractItemsListViewTool::closeEditor()
{
    QLayoutItem * itemBrowser = static_cast<QGridLayout*>(layout())->itemAtPosition(2,0);
    if (!itemBrowser)
        return;
    QWidget * browser = itemBrowser->widget();
    if (!browser)
        return;
    static_cast<QGridLayout*>(layout())->removeWidget(browser);
    browser->deleteLater();
}
void SeExprEdColorSwatchWidget::removeSwatch(SeExprEdColorFrame *widget)
{
    QWidget * parentWidget = widget->parentWidget();
    // Find given widget to remove from grid layout
    for (int i=0; i<_gridLayout->count(); i++){
        if (_gridLayout->itemAt(i)->widget() == parentWidget){
            _gridLayout->removeWidget(parentWidget);
            parentWidget->deleteLater();
            emit swatchRemoved(i);
            break;
        }
    }
}
Example #24
0
void RootController::dismissWidget()
{
	if(!m_dismissable) return;
	QWidget *widget = m_stack.pop();
	QWidget *next = m_stack.size() ? m_stack.top() : 0;
	if(next) next->move(widget->pos());
	
	present(next);
	
	widget->hide();
	if(m_ownership.value(widget)) widget->deleteLater();
	m_ownership.remove(widget);
}
Example #25
0
void MainWindow::deleteProgressWidget()
{
    if (m_ui.stackedWidget->count() != 2)
        return;

    m_ui.abortButton->setVisible(true);
    m_ui.nextButton->setVisible(true);
    m_ui.previousButton->setVisible(true);

    while (m_ui.stackedWidget->count() != 1) {
        QWidget *w = m_ui.stackedWidget->widget(1);
        m_ui.stackedWidget->removeWidget(w);
        w->deleteLater();
    }
}
void GameUI::quit(){

    // Take the current board game out of the central widget of MainWindow
    QWidget* wid = this->centralWidget();
    //wid->setParent(NULL);
    // Line above will delete the widget gracefully (no memory errors)

    // Display something which says that you lost, maybe display high score.
    wid->deleteLater();
    // Reset the MainWindow with the initial startup screen
    ui->setupUi(this);
    QMessageBox::information(this,tr("WTF"),tr("hope to see you again!"));


}
Example #27
0
/*************************************************
Function Name: clearAll()
Description:  删除所有
*************************************************/
void IMSearchListWidget::clearAll()
{
//    while(m_layout->count() > 0)
//    {
//        m_layout->removeItem(m_layout->itemAt(0));
//    }
    QLayoutItem *child;
     while ((child = m_layout->takeAt(0)) != 0)
     {
         m_layout->removeItem(child);
         QWidget *widget = child->widget();
         if (widget != NULL)
         widget->deleteLater();
     }
}
void GameUI::next_level(){

    // Take the current board game out of the central widget of MainWindow
    QWidget* wid = this->centralWidget();
    //wid->setParent(NULL);
    // Line above will delete the widget gracefully (no memory errors)

    // Display something which says that you lost, maybe display high score.

    // Reset the MainWindow with the initial startup screen
    //ui->setupUi(this);
    QMessageBox::information(this,tr("WTF"),tr("cong! go to next level"));
    board = new GameBoard(this,20,4,20,50,2);
    this->setCentralWidget(board);
    wid->deleteLater();
}
Example #29
0
void WaitForWindowTest::testWaitEndedNotActive() {
    WaitForWindow waitForWindow("theName");

    qRegisterMetaType<WaitFor*>("WaitFor*");
    QSignalSpy waitEndedSpy(&waitForWindow, SIGNAL(waitEnded(WaitFor*)));

    QWidget* window = new QWidget(mMainWindow);
    window->setObjectName("theName");
    window->setWindowFlags(Qt::Window);
    window->show();

    window->deleteLater();

    QVERIFY(!waitForWindow.conditionMet());
    QCOMPARE(waitEndedSpy.count(), 0);
}
Example #30
0
void Window::Destroy()
{
    QWidget *w = PWindow(wid);

    if (w)
    {
        // Delete the widget next time round the event loop rather than
        // straight away.  This gets round a problem when auto-completion lists
        // are cancelled after an entry has been double-clicked, ie. the list's
        // dtor is called from one of the list's slots.  There are other ways
        // around the problem but this is the simplest and doesn't seem to
        // cause problems of its own.
        w->deleteLater();
        wid = 0;
    }
}