///
///returns an identifying path from a widget
///
QString getWidgetPath(QObject* o)
{
    assert ( o );
    //get the object path
    QString opath;

    if ( o->isWidgetType() )
    {
        QWidget *w = dynamic_cast<QWidget*> ( o );

        if ( w->objectName() == "" )
            w->setObjectName ( getWidgetName ( w ) );

        opath = w->objectName();

        while ( w->parent() != NULL )
        {
            w = dynamic_cast<QWidget*> ( w->parent() );

            if ( w->objectName() == "" )
                w->setObjectName ( getWidgetName ( w ) );

            opath = w->objectName() + "/" + opath;
        }
    }

    return opath;
}
void PartConfigGeneralWidget::setModified()
{
	QWidget *sendingWidget = qobject_cast<QWidget*>(sender());
	QSettings settings(ORGNAME, APPNAME);
	if (sendingWidget->objectName() == QLatin1String("latexUrlRequester"))
		emit changed(ui.latexUrlRequester->text() != settings.value("LatexCommand", "pdflatex").toString());
	else if (sendingWidget->objectName() == QLatin1String("pdftopsUrlRequester"))
		emit changed(ui.pdftopsUrlRequester->text() != settings.value("PdftopsCommand", "pdftops").toString());
	else if (sendingWidget->objectName() == QLatin1String("editorUrlRequester"))
		emit changed(ui.editorUrlRequester->text() != settings.value("TemplateEditor", "kwrite").toString());
	else if (sendingWidget->objectName() == QLatin1String("replaceEdit"))
		emit changed(ui.replaceEdit->text() != settings.value("TemplateReplaceText", "<>").toString());
}
Example #3
0
QString QWidgetProto::toString() const
{
  QWidget *item = qscriptvalue_cast<QWidget*>(thisObject());
  if (item)
    return QString(item->objectName());
  return QString();
}
Example #4
0
HistoryCompleter::HistoryCompleter(QObject *parent)
    : QCompleter(parent)
    , d_ptr(new HistoryCompleterPrivate(this))
{
    // make an assumption to allow pressing of the down
    // key, before the first model run:
    // parent is likely the lineedit
    QWidget *p = qobject_cast<QWidget *>(parent);
    if (p) {
        p->installEventFilter(d_ptr->model);
        QString objectName = p->objectName();
        if (objectName.isEmpty())
            return;
        d_ptr->model->list = d_ptr->model->settings->value(objectName).toStringList();
    }

    QLineEdit *l = qobject_cast<QLineEdit *>(parent);
    if (l && d_ptr->model->list.count())
        l->setText(d_ptr->model->list.at(0));

    setModel(d_ptr->model);
    HistoryLineDelegate *delegate = new HistoryLineDelegate;
    HistoryLineView *view = new HistoryLineView(d_ptr, delegate->pixmap.width());
    setPopup(view);
    view->setItemDelegate(delegate);
}
Example #5
0
STDAPI DllCanUnloadNow()
{
    if (GetCurrentThreadId() != qAxThreadId)
        return S_FALSE;
    if (qAxLockCount())
        return S_FALSE;
    if (!qax_ownQApp)
        return S_OK;
    
    // check if qApp still runs widgets (in other DLLs)
    QWidgetList widgets = qApp->allWidgets();
    int count = widgets.count();
    for (int w = 0; w < widgets.count(); ++w) {
        // remove all Qt generated widgets
        QWidget *widget = widgets.at(w);
        if (widget->windowType() == Qt::Desktop || widget->objectName() == QLatin1String("Qt internal tablet widget"))
            count--;
    }
    if (count)
        return S_FALSE;
    
    // no widgets left - destroy qApp
    if (qax_hhook)
        UnhookWindowsHookEx(qax_hhook);
    
    delete qApp;
    qax_ownQApp = false;
    
    // never allow unloading - safety net for Internet Explorer
    return S_FALSE;
}
Example #6
0
void
Style::dockLocationChanged( Qt::DockWidgetArea /*area*/ )
{
    QDockWidget *dock = carriedDock ? carriedDock : qobject_cast<QDockWidget*>( sender() );
    if ( !dock )
        return;
    if ( dock->isFloating() || !Hacks::config.lockDocks )
    {
        if ( QWidget *title = dock->titleBarWidget() )
        {
            if ( title->objectName() ==  "bespin_docktitle_dummy" )
            {
                dock->setTitleBarWidget(0);
                title->deleteLater();
            }
            else
                title->show();
        }
    }
    else
    {
        QWidget *title = dock->titleBarWidget();
        if ( !title )
        {
            title = new QWidget;
            title->setObjectName( "bespin_docktitle_dummy" );
            dock->setTitleBarWidget( title );
        }
        if ( title->objectName() ==  "bespin_docktitle_dummy" )
            dock->titleBarWidget()->hide();
    }
}
Example #7
0
void addGridLines(QGridLayout *grid)
{
  for(int y = 0; y < grid->rowCount(); y++)
  {
    for(int x = 0; x < grid->columnCount(); x++)
    {
      QLayoutItem *item = grid->itemAtPosition(y, x);
      QLayoutItem *east = grid->itemAtPosition(y, x + 1);
      QLayoutItem *south = grid->itemAtPosition(y + 1, x);

      if(item == NULL)
        continue;

      QWidget *w = item->widget();

      if(w == NULL)
        continue;

      QString name = w->objectName();

      QString style;

      style += "border: solid black; border-top-width: 1px; border-left-width: 1px;";

      if(!east || !east->widget())
        style += "border-right-width: 1px;";
      if(!south || !south->widget())
        style += "border-bottom-width: 1px;";

      w->setStyleSheet(style);
    }
  }
}
Example #8
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;
}
Example #9
0
//table button clicked
void MainWindow::Add_Clicked()
{
    QWidget *sender = (QWidget *) QObject::sender();
    std::cout<<"ADD.."<<sender->objectName().toStdString()<<std::endl;

    if(sender == ui->mt_navTable1_button1 ){
        tableAddRow(ui->mt_tableView1);
    }
    /*
    else if(sender == ui->mt_navTable2_button1){
        tableAddRow(ui->mt_tableWidget2);
    }
    else if(sender == ui->ft_navTable1_button1){
        tableAddRow(ui->ft_tableWidget1);
    }
    else if(sender == ui->ft_navTable2_button1){
       tableAddRow(ui->ft_tableWidget2);
    }
    else if(sender == ui->at_navTable1_button1){
        tableAddRow(ui->at_tableWidget1);
    }
    else if(sender == ui->at_navTable2_button1){
        tableAddRow(ui->at_tableWidget2);
    }
    */
}
Example #10
0
void aboutDialog::mouseReleaseEvent(QMouseEvent *me)
{
	QWidget *child = QWidget::childAt(me->pos());

	if(child)
	{
		QString name = child->objectName();

		if(name == "label_Mail")
		{
            QDesktopServices::openUrl(QUrl(QByteArray::fromBase64("bWFpbHRvOkxhenlUQGdteC5uZXQ/c3ViamVjdD1TRURVQ0ZHJmJvZHk9V3JpdGUgaW4gRW5nbGlzaCBvciBHZXJtYW4gcGxlYXNlLi4u")));
		}
		else if(name == "label_Forum")
		{
            QDesktopServices::openUrl(QUrl(QByteArray::fromBase64("aHR0cDovL3d3dy5sZWRzdHlsZXMuZGUvaW5kZXgucGhwL0JvYXJkLzM3LUxFRC1Ub29scy1UdXRvcmlhbHM=")));
		}
		else if(name == "label_Donation")
		{
			if(QMessageBox::warning(this, APPNAME, tr("Please note the following points:\n\n* The payment is made voluntarily without the acquisition of claims.\n* You receive no rights to the offered software.\n* Because this is not a donation in juridical sense no certificate can be issued.\n\nWould you like to support the further development of this project nevertheless?"), QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes) == QMessageBox::Yes)
			{
				new donationDialog((QWidget*)parent());
			}
		}
		else if(name == "label_Update")
		{
            QDesktopServices::openUrl(QUrl(QByteArray::fromBase64("aHR0cHM6Ly9naXRodWIuY29tL0xhenlUL3NlZHVjZmcvcmVsZWFzZXM=")));
		}
		else if(name == "label_Language")
		{
            QDesktopServices::openUrl(QUrl(QByteArray::fromBase64("aHR0cHM6Ly9naXRodWIuY29tL0xhenlUL3NlZHVjZmcvdHJlZS9tYXN0ZXIvbG5n")));
		}
	}
}
Example #11
0
void EditorBase::LoadTools()
{
    ModuleManager::Instance()->LoadModulesInFolder( "Plugins/Tools/" );

    // Create the tools and init their UI;
    Class::Iterator itClassesNew( EditorTool::StaticClass() );
    for( ; itClassesNew.IsValid(); ++itClassesNew )
    {
        EditorTool* newTool = Cast<EditorTool>((*itClassesNew)->AllocateNew());

        try
        {
            newTool->SetEditor(this);

            QWidget* toolWidget = newTool->CreateUI();
            if( toolWidget != mMainView )
            {
                QDockWidget* contentsWindow = GD_NEW(QDockWidget, this, 0)(toolWidget->objectName(), this);
                contentsWindow->setWidget(toolWidget);
                addDockWidget(Qt::LeftDockWidgetArea, contentsWindow);
            }

            newTool->Hide();
            mTools[(*itClassesNew)->GetName()] = newTool;
        }
        catch( Exception& e )
        {
            qWarning( e.GetMessage().c_str() );
            GD_DELETE(newTool);
        }
    }
}
Example #12
0
void MyWidget::responseToShow(int a, int b)
{
	qDebug() <<"hello";
	qDebug() <<this->metaObject()->className();
	QWidget *w = new QWidget(this);
	qDebug() <<w->objectName();
}
void ParametersToolBox::setupUi()
{
	this->removeItem(0); // remove dummy page used in .ui
	QWidget * currentItem = 0;
	const ParametersMap & parameters = Settings::getParameters();
	for(ParametersMap::const_iterator iter=parameters.constBegin();
			iter!=parameters.constEnd();
			++iter)
	{
		QStringList splitted = iter.key().split('/');
		QString group = splitted.first();
		QString name = splitted.last();
		if(currentItem == 0 || currentItem->objectName().compare(group) != 0)
		{
			currentItem = new QWidget(this);
			this->addItem(currentItem, group);
			currentItem->setObjectName(group);
			QVBoxLayout * layout = new QVBoxLayout(currentItem);
			currentItem->setLayout(layout);
			layout->setContentsMargins(0,0,0,0);
			layout->setSpacing(0);
			layout->addSpacerItem(new QSpacerItem(0,0, QSizePolicy::Minimum, QSizePolicy::Expanding));

			addParameter(layout, iter.key(), iter.value());
		}
		else
		{
			addParameter((QVBoxLayout*)currentItem->layout(), iter.key(), iter.value());
		}
	}

	updateParametersVisibility();
}
//-----------------------------------------------------------------------------
void swftParaViewMenuBuilders::buildPipelineBrowserContextMenu(QWidget& widget)
{
  QString objectName = widget.objectName();
  Ui::pqPipelineBrowserContextMenu ui;
  ui.setupUi(&widget);
  // since the UI file tends to change the name of the menu.
  widget.setObjectName(objectName);
  widget.setContextMenuPolicy(Qt::ActionsContextMenu);

  QByteArray signalName=QMetaObject::normalizedSignature("deleteKey()");
  if (widget.metaObject()->indexOfSignal(signalName) != -1)
    {
    // Trigger a delete when the user requests a delete.
    QObject::connect(&widget, SIGNAL(deleteKey()),
      ui.actionPBDelete, SLOT(trigger()), Qt::QueuedConnection);
    }

  // And here the reactions come in handy! Just reuse the reaction used for
  // File | Open.
  new swftLoadModelReaction(ui.actionPBOpen);
  new pqChangePipelineInputReaction(ui.actionPBChangeInput);
  new pqCreateCustomFilterReaction(ui.actionPBCreateCustomFilter);
  new pqIgnoreSourceTimeReaction(ui.actionPBIgnoreTime);
  new pqDeleteReaction(ui.actionPBDelete);
  new pqCopyReaction(ui.actionPBCopy);
  new pqCopyReaction(ui.actionPBPaste, true);
}
Example #15
0
QString LayoutDumper::getWidgetInfo(const QWidget& w)
{
    const QRect& geom = w.geometry();
    QSize sizehint = w.sizeHint();
    QSize minsizehint = w.minimumSizeHint();
    // Can't have >9 arguments to QString arg() system.
    // Using QStringBuilder with % leads to more type faff.
    QStringList elements;
    elements.append(QString("%1 %2 ('%3')")
                    .arg(w.metaObject()->className())
                    .arg(toString((void*)&w))
                    .arg(w.objectName()));
    elements.append(QString("pos (%1, %2)")
                    .arg(geom.x())
                    .arg(geom.y()));
    elements.append(QString("size (%1 x %2)")
                    .arg(geom.width())
                    .arg(geom.height()));
//    elements.append(QString("minimumSize (%1 x %2)")
//                    .arg(w.minimumSize().width())
//                    .arg(w.minimumSize().height()));
//    elements.append(QString("maximumSize (%1 x %2)")
//                    .arg(w.maximumSize().width())
//                    .arg(w.maximumSize().height()));
    elements.append(QString("sizeHint (%1 x %2), minimumSizeHint (%3 x %4), policy %5")
                    .arg(sizehint.width())
                    .arg(sizehint.height())
                    .arg(minsizehint.width())
                    .arg(minsizehint.height())
                    .arg(toString(w.sizePolicy())));
    elements.append(QString("stylesheet=%1")
                    .arg(w.styleSheet().isEmpty() ? "false" : "true"));
    elements.append(w.isVisible() ? "visible" : "HIDDEN");
    return elements.join(", ");
}
Example #16
0
void MainWindow::getResultofScaleUp(std::string filename)
{
	ImageStorage* imgstore = ImageStorage::getInstance();

	if (imgstore->isEmpty())
	{
		QMessageBox::warning(this, tr("Error"), tr("No image..."));
		return;
	}

	std::pair<const std::string, Ui::SrcAndRes>* pos = imgstore->find(filename);

	cv::Mat results = controller->getLastResult();
	std::string s_name = pos->first;
	s_name.append("_label");

	QString qname = QString::fromStdString(s_name);
	QString pageName = QString::fromStdString(filename);
	QWidget * t = ui->imageTab->findChild<QWidget*>(pageName);
	QString s = t->objectName();
	QLabel * label = t->findChild<QLabel *>(qname);
	ASSERT(label != nullptr);

	displayImg(results, label);

	std::get<1>(pos->second) = results.clone();
	std::get<2>(pos->second).push_back(results.clone());

	ui->goBtn->setEnabled(true);
	//ui->processBtn->setEnabled(true);
	ui->showDiffBtn->setEnabled(true);
	ui->loadCfBtn->setEnabled(true);
}
Example #17
0
File: about.cpp Project: LazyT/obpm
void aboutDialog::mouseReleaseEvent(QMouseEvent *me)
{
	QWidget *child = QWidget::childAt(me->pos());

	if(child)
	{
		QString name = child->objectName();

		if(name == "label_Mail")
		{
			QDesktopServices::openUrl(QUrl(QByteArray::fromBase64("bWFpbHRvOkxhenlUQG1haWxib3gub3JnP3N1YmplY3Q9T0JQTSZib2R5PVdyaXRlIGluIEVuZ2xpc2ggb3IgR2VybWFuIHBsZWFzZS4uLg==")));
		}
		else if(name == "label_Forum")
		{
			QDesktopServices::openUrl(QUrl(QByteArray::fromBase64("aHR0cDovL2JvYXJkLm5ldGRva3Rvci5kZS9iZWl0cmFnL2JsdXRkcnVja21lc3NnZXJhZXQtb21yb24tbTUwMGl0LWJlc2l0emVyLXRlc3Rlci1nZXN1Y2h0LjI1MjU1MQ==")));
		}
		else if(name == "label_Donation")
		{
			if(QMessageBox::warning(this, APPNAME, tr("Please note the following points:\n\n* The payment is made voluntarily without the acquisition of claims.\n* You receive no rights to the offered software.\n* Because this is not a donation in juridical sense no certificate can be issued.\n\nWould you like to support the further development of this project nevertheless?"), QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes) == QMessageBox::Yes)
			{
				new donationDialog((QWidget*)parent());
			}
		}
		else if(name == "label_Update")
		{
			QDesktopServices::openUrl(QUrl(QByteArray::fromBase64("aHR0cHM6Ly9naXRodWIuY29tL0xhenlUL29icG0vcmVsZWFzZXM=")));
		}
		else if(name == "label_Language")
		{
			QDesktopServices::openUrl(QUrl(QByteArray::fromBase64("aHR0cHM6Ly9naXRodWIuY29tL0xhenlUL29icG0vdHJlZS9tYXN0ZXIvbG5n")));
		}
	}
}
Example #18
0
void EmbeddedWebView::findScrollParent()
{
    if (m_scrollParent)
        m_scrollParent->removeEventFilter(this);
    m_scrollParent = 0;
    m_scrollParentPadding = 4;
    QWidget *runner = this;
    int left, top, right, bottom;
    while (runner) {
        runner->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred);
        runner->getContentsMargins(&left, &top, &right, &bottom);
        m_scrollParentPadding += left + right + 4;
        if (runner->layout()) {
            runner->layout()->getContentsMargins(&left, &top, &right, &bottom);
            m_scrollParentPadding += left + right;
        }
        QWidget *p = runner->parentWidget();
        if (p && qobject_cast<MessageView*>(runner) && // is this a MessageView?
            p->objectName() == "qt_scrollarea_viewport" && // in a viewport?
            qobject_cast<QAbstractScrollArea*>(p->parentWidget())) { // that is used?
            p->getContentsMargins(&left, &top, &right, &bottom);
            m_scrollParentPadding += left + right + 4;
            if (p->layout()) {
                p->layout()->getContentsMargins(&left, &top, &right, &bottom);
                m_scrollParentPadding += left + right;
            }
            m_scrollParent = p->parentWidget();
            break; // then we have our actual message view
        }
        runner = p;
    }
    m_scrollParentPadding += style()->pixelMetric(QStyle::PM_ScrollBarExtent, 0, m_scrollParent);
    if (m_scrollParent)
        m_scrollParent->installEventFilter(this);
}
Example #19
0
void
Radio_Impl::setGroup(const QString& group)
{
	QString groupName;
	QWidget *window = this->window();
	
	fGroup = group;
	if (window)
		groupName = QString("[%1]/%2").arg(window->objectName()).arg(group);
	else
		groupName = QString("[]/%1").arg(group);
	
	if (fButtonGroup) {
		fButtonGroup->removeButton(this);
		if (fButtonGroup->buttons().size() == 0) {
			sButtonGroups.remove(fButtonGroup->objectName());
			delete fButtonGroup;
		}
	}
	
	fButtonGroup = sButtonGroups[groupName];
	if (!fButtonGroup) {
		fButtonGroup = new QButtonGroup();
		fButtonGroup->setObjectName(groupName);
		sButtonGroups[groupName] = fButtonGroup;
	}
	fButtonGroup->addButton(this);
}
Example #20
0
bool GUIApplication::notify (QObject * receiver, QEvent * event)
{
    if (!receiver && event) {
        Base::Console().Log("GUIApplication::notify: Unexpected null receiver, event type: %d\n",
            (int)event->type());
    }
    try {
        if (event->type() == Spaceball::ButtonEvent::ButtonEventType || 
            event->type() == Spaceball::MotionEvent::MotionEventType)
            return processSpaceballEvent(receiver, event);
        else
            return QApplication::notify(receiver, event);
    }
    catch (const Base::SystemExitException&) {
        qApp->exit(systemExit);
        return true;
    }
    catch (const Base::Exception& e) {
        Base::Console().Error("Unhandled Base::Exception caught in GUIApplication::notify.\n"
                              "The error message is: %s\n", e.what());
    }
    catch (const std::exception& e) {
        Base::Console().Error("Unhandled std::exception caught in GUIApplication::notify.\n"
                              "The error message is: %s\n", e.what());
    }
    catch (...) {
        Base::Console().Error("Unhandled unknown exception caught in GUIApplication::notify.\n");
    }

    // Print some more information to the log file (if active) to ease bug fixing
    if (receiver && event) {
        try {
            std::stringstream dump;
            dump << "The event type " << (int)event->type() << " was sent to "
                 << receiver->metaObject()->className() << "\n";
            dump << "Object tree:\n";
            if (receiver->isWidgetType()) {
                QWidget* w = qobject_cast<QWidget*>(receiver);
                while (w) {
                    dump << "\t";
                    dump << w->metaObject()->className();
                    QString name = w->objectName();
                    if (!name.isEmpty())
                        dump << " (" << (const char*)name.toUtf8() << ")";
                    w = w->parentWidget();
                    if (w)
                        dump << " is child of\n";
                }
                std::string str = dump.str();
                Base::Console().Log("%s",str.c_str());
            }
        }
        catch (...) {
            Base::Console().Log("Invalid recipient and/or event in GUIApplication::notify\n");
        }
    }

    return true;
}
Example #21
0
QWidget* getMainWindow()
{
	QWidget *mainwindow = Q_NULLPTR;
	foreach(mainwindow, QApplication::topLevelWidgets()) {
	  if(mainwindow->objectName() == "main_window")
		break;
	}
	return mainwindow;
}
void MainTabsWidget::closeTab(unsigned int index)
{
    QWidget * w = widget(index);

        if (w->objectName() != "valueTab" || w->objectName() != "valueTabReady") {

            removeTab(index);

            delete w;
        } else {

            ValueTab * tab = qobject_cast<ValueTab *> (widget(index));

            removeTab(index);

            tab->close();
        }
}
Example #23
0
bool FramelessDlg::winEvent(MSG *message, long *result)
{	
	switch (message->message) 
	{
	case WM_NCHITTEST:
		int xPos = GET_X_LPARAM(message->lParam) - this->frameGeometry().x();
		int yPos = GET_Y_LPARAM(message->lParam) - this->frameGeometry().y();

		QWidget* w = childAt(xPos, yPos);

		if ( w && 
			( w->objectName() == "closeBtn"
			|| w->objectName() == "minBtn" 
			|| w->objectName() == "menuBtn" ) )
		{
			return false;
		}

		if ( yPos >= 0 && yPos < 50 )
			*result = HTCAPTION;

		if ( xPos > 1 && xPos < 6 ) 
			*result = HTLEFT;
		if ( xPos > (this->width() - 6) && xPos < (this->width() - 1) )
			*result = HTRIGHT;
		if ( yPos > 1 && yPos < 6 )
			*result = HTTOP;
		if ( yPos > (this->height() - 6) && yPos < (this->height() - 1) )
			*result = HTBOTTOM;
		if ( xPos > 1 && xPos < 6 && yPos > 1 && yPos < 6 )
			*result = HTTOPLEFT;
		if ( xPos > (this->width() - 6) && xPos < (this->width() - 1) && yPos > 1 && yPos < 6 )
			*result = HTTOPRIGHT;
		if ( xPos > 1 && xPos < 6 && yPos > (this->height() - 6) && yPos < (this->height() - 1) )
			*result = HTBOTTOMLEFT;
		if ( xPos > (this->width() - 6) && xPos < (this->width() - 1) && yPos > (this->height() - 6) && yPos < (this->height() - 1) )
			*result = HTBOTTOMRIGHT;
		if ( *result )
			return true;

		break;
	}
	return false;
}
Example #24
0
EditTagDialog::EditTagDialog(Application* app, QWidget* parent)
  : QDialog(parent),
    ui_(new Ui_EditTagDialog),
    app_(app),
    album_cover_choice_controller_(new AlbumCoverChoiceController(this)),
    loading_(false),
    ignore_edits_(false),
    tag_fetcher_(new TagFetcher(this)),
    cover_art_id_(0),
    cover_art_is_set_(false),
    results_dialog_(new TrackSelectionDialog(this))
{
  cover_options_.default_output_image_ =
      AlbumCoverLoader::ScaleAndPad(cover_options_, QImage(":nocover.png"));

  connect(app_->album_cover_loader(), SIGNAL(ImageLoaded(quint64,QImage,QImage)),
          SLOT(ArtLoaded(quint64,QImage,QImage)));

  connect(tag_fetcher_, SIGNAL(ResultAvailable(Song, SongList)),
          results_dialog_, SLOT(FetchTagFinished(Song, SongList)),
          Qt::QueuedConnection);
  connect(tag_fetcher_, SIGNAL(Progress(Song,QString)),
          results_dialog_, SLOT(FetchTagProgress(Song,QString)));
  connect(results_dialog_, SIGNAL(SongChosen(Song, Song)),
          SLOT(FetchTagSongChosen(Song, Song)));
  connect(results_dialog_, SIGNAL(finished(int)), tag_fetcher_, SLOT(Cancel()));

  album_cover_choice_controller_->SetApplication(app_);

  ui_->setupUi(this);
  ui_->splitter->setSizes(QList<int>() << 200 << width() - 200);
  ui_->loading_label->hide();

  // An editable field is one that has a label as a buddy.  The label is
  // important because it gets turned bold when the field is changed.
  foreach (QLabel* label, findChildren<QLabel*>()) {
    QWidget* widget = label->buddy();
    if (widget) {
      // Store information about the field
      fields_ << FieldData(label, widget, widget->objectName());

      // Connect the Reset signal
      if (dynamic_cast<ExtendedEditor*>(widget)) {
        connect(widget, SIGNAL(Reset()), SLOT(ResetField()));
      }

      // Connect the edited signal
      if (qobject_cast<QLineEdit*>(widget)) {
        connect(widget, SIGNAL(textChanged(QString)), SLOT(FieldValueEdited()));
      } else if (qobject_cast<QPlainTextEdit*>(widget)) {
        connect(widget, SIGNAL(textChanged()), SLOT(FieldValueEdited()));
      } else if (qobject_cast<QSpinBox*>(widget)) {
        connect(widget, SIGNAL(valueChanged(int)), SLOT(FieldValueEdited()));
      }
    }
  }
Example #25
0
bool SGMainWindowEvent::eventFilter(QObject* object, QEvent* evt) {
	QWidget* focusWidget = QApplication::focusWidget();
	if (focusWidget == NULL) return true;
	if (m_focusWidgetName == focusWidget->objectName().toStdString().c_str()) return QObject::eventFilter(object, evt);

	QObjectList objList = focusWidget->children();
	bool glWidgetExists = false;
	for (int i = 0; i < objList.length(); i++) {
		QWidget* widget = (QWidget*)objList[i];
		QObjectList objList2 = widget->children();
		for (int j = 0; j < objList2.length(); j++) {
			QWidget* widget2 = (QWidget*)objList2[j];
			if (strcmp(widget2->metaObject()->className(), "QmayaGLWidget") == 0) {
				if (m_beforeWidget != NULL) {
					m_beforeWidget->releaseKeyboard();
					m_beforeWidget->removeEventFilter(toolEvent);
				}
				widget2->installEventFilter(toolEvent);
				widget2->grabKeyboard();

				m_beforeWidget = widget2;

				m_focusWidgetName = focusWidget->objectName().toStdString().c_str();
				glWidgetExists = true;

				SGKey::initializeKeys();
				SGMouse::initializeButtons();
				break;
			}
		}
		if (glWidgetExists)break;
	}

	if (!glWidgetExists) {
		if (m_beforeWidget != NULL) {
			m_beforeWidget->releaseKeyboard();
			m_beforeWidget->removeEventFilter(toolEvent);
		}
		m_focusWidgetName = focusWidget->objectName().toStdString().c_str();
	}

	return QObject::eventFilter(object, evt);
}
Example #26
0
//slot for deleting QFrames with the delete buttons
void MultisigDialog::deleteFrame()
{
   QWidget *buttonWidget = qobject_cast<QWidget*>(sender());
   if(!buttonWidget)return;

   //if deleting last raw input/priv key, hide scroll area
   if(buttonWidget->objectName() == "inputDeleteButton" && ui->inputsList->count() == 1){
       isFirstRawTx = true;
       ui->txInputsScrollArea->hide();
   }else if(buttonWidget->objectName() == "keyDeleteButton" && ui->keyList->count() == 1){
       isFirstPrivKey = true;
       ui->keyScrollArea->hide();
   }

   QFrame* frame = qobject_cast<QFrame*>(buttonWidget->parentWidget());
   if(!frame)return;

   delete frame;
}
Example #27
0
bool CDirectionWidget::eventFilter(QObject *object, QEvent *event)
{
	QWidget *widget = qobject_cast<QWidget *>(object);
	switch (event->type())
	{
	case QEvent::Paint:
	{
		float x;
		if (widget->objectName() == "XZ")
			x = _value.x;
		else
			x = _value.y;
		QPainter painter(widget);
		painter.setRenderHint(QPainter::Antialiasing, true);
		painter.setBrush(QBrush(Qt::white));
		painter.setPen(QPen(Qt::black, 2, Qt::SolidLine));
		painter.drawRoundedRect(QRect(3, 3, widget->width() - 6, widget->height() - 6), 3.0, 3.0);
		painter.setPen(QPen(Qt::gray, 1, Qt::SolidLine));
		painter.drawLine(widget->width() / 2, 4, widget->width() / 2, widget->height() - 4);
		painter.drawLine(4, widget->height() / 2, widget->width() - 4, widget->height() / 2);
		painter.drawText( 10, 15, widget->objectName());
		painter.setPen(QPen(Qt::red, 2, Qt::SolidLine));
		painter.drawLine(widget->width() / 2, widget->height() / 2,
						 int((widget->width() / 2) + x * 0.9f * directionSize), int((widget->height() / 2) - _value.z * 0.9f * directionSize));
		break;
	}
	case QEvent::MouseButtonDblClick:
	{
		QMouseEvent *mouseEvent = (QMouseEvent *) event;
		float vx = (mouseEvent->x() - (widget->width() / 2)) / 0.9f;
		float vy = ((widget->height() / 2) - mouseEvent->y()) / 0.9f;

		if (widget->objectName() == "XZ")
			setNewVecXZ(vx, vy);
		else
			setNewVecYZ(vx, vy);

		break;
	}
	}
	return QWidget::eventFilter(object, event);
}
void PairwiseRegistrationDialog::on_sourceComboBox_currentIndexChanged(const QString &cloudName_source)
{
	QString cloudName_target = targetComboBox->currentText();
	QString pairName = cloudName_target + "<-" + cloudName_source;

	QWidget *current = tabWidget->currentWidget();
	if ((current != NULL) && (pairName == current->objectName())) return;

	QWidget *toBeCurrent = tabWidget->findChild<QWidget*>(pairName);
	if(toBeCurrent != NULL) tabWidget->setCurrentWidget(toBeCurrent);
}
Example #29
0
void ToolBoxManager::retranslate() const
{
    int ct = _toolBox->count();
    for (int i=0; i<ct; i++) {
        // get always the first item widget
        QWidget* w = _toolBox->widget(i);
        QByteArray toolbarName = w->objectName().toUtf8();
        w->setWindowTitle(QObject::trUtf8(toolbarName.constData()));
        _toolBox->setItemText(i, w->windowTitle());
    }
}
Example #30
0
void GTUtilsOptionsPanel::runFindPatternWithHotKey( const QString& pattern, HI::GUITestOpStatus& os){
    GTKeyboardDriver::keyClick( 'f', Qt::ControlModifier);
    GTGlobals::sleep();

    QWidget *w = QApplication::focusWidget();
    GT_CHECK(w && w->objectName()=="textPattern", "Focus is not on FindPattern widget");

    GTKeyboardDriver::keySequence(pattern);
    GTGlobals::sleep(1000);
    GTKeyboardDriver::keyClick(Qt::Key_Enter);
    GTThread::waitForMainThread();
}