示例#1
0
Scene::Scene( QWidget * parent, const QGLWidget * shareWidget, Qt::WFlags flags) : QGLViewer(parent, shareWidget, flags)
{
	activeMesh = NULL;

	activeFrame = new ManipulatedFrame();
	setManipulatedFrame(activeFrame);

	// GLViewer options
	setGridIsDrawn();

	// TEXT ON SCREEN
	timer = new QTimer(this);
	connect(timer, SIGNAL(timeout()), SLOT(dequeueLastMessage()));

	// Mouse selection window
	this->setSelectRegionHeight(10);
	this->setSelectRegionWidth(10);
	this->selectMode = CONTROLLER;

	// Take focus
	this->setFocus();
	emit(gotFocus(this));

	// Stacker stuff
	sp = NULL;
	activeDeformer = NULL;
	activeVoxelDeformer = NULL;
	isShowStacked = false;
	isDrawOffset = false;

	displayMessage(tr("New scene created."));
}
bool PasswordInput::event(QEvent* event)
{
	if( event->type() == QEvent::FocusIn ) {
		this->clear();
		emit gotFocus();
	}
	return QLineEdit::event(event);
}
示例#3
0
void TooltipView::
        initialize()
{
    initialized = true;

    connect(model_->comment.data(), SIGNAL(thumbnailChanged(bool)), SLOT(setHidden(bool)));
    connect(model_->comment.data(), SIGNAL(gotFocus()), SLOT(setFocus()));
    connect(model_->comment.data(), SIGNAL(destroyed()), SLOT(seppuku()));
}
示例#4
0
文件: dialog.cpp 项目: pva701/codes
void Dialog::createWidget() {
    createdWidgetx = true;
    dgReadByUser = false;

    int w = smiles->size().width() / W_CNT;
    int h = smiles->size().height() / H_CNT;
    lwHistory = new QListWidget();
    teMessage = new TextEditMessage();
    //teHistory->setReadOnly(true);
    addWidget(lwHistory);
    setStretchFactor(0, 2);

    panel = new QToolBar();
    QIcon newIcon = QPixmap::fromImage(smiles->copy(w, 0, w, h));
    QAction *a = new QAction(newIcon, QString("&Smiles"), 0);
    a->setPriority(QAction::LowPriority);
    a->setShortcut(Qt::CTRL + Qt::Key_S);
    connect(a, SIGNAL(triggered()), this, SLOT(slotClickedSmileMenu()));
    panel->addAction(a);
    panel->setFixedHeight(30);
    //panel->pos()
    /*QMenuBar *panel = new QMenuBar(this);
    panel->setFixedHeight(30);
    panel->setAutoFillBackground(true);
    panel->setStyleSheet("QMenuBar { background-color: #f3f2f1; } QMenuBar::item { background-color: #f3f2f1; }");
    //panel->setStyleSheet("QMenuBar::item { icon-size: 32px; } ");
    //panel->setStyleSheet("QMenuBar::button { background-color: #ffffff; }");*/
    addWidget(panel);
    addWidget(teMessage);

    smileMenu = new QMenu("Smiles");
    smileMenu->setIcon(QPixmap::fromImage(smiles->copy(w, 0, w, h)));
    smileMenu->setStyleSheet("QMenu { background-color: #ffffff;}");

    QGridLayout *lytSmiles = new QGridLayout(smileMenu);
    QPalette palw;
    palw.setBrush(smileMenu->backgroundRole(), Qt::white);
    smileMenu->setAutoFillBackground(true);
    smileMenu->setPalette(palw);
    for (int i = 0; i < W_CNT; ++i)
        for (int j = 0; j < H_CNT; ++j) {
            QImage icon = smiles->copy(j * w, i * h, w, h);
            SmileButton *but = new SmileButton(icon, W_CNT * i + j);
            connect(but, SIGNAL(clicked()), this, SLOT(slotSmilesClicked()));
            lytSmiles->addWidget(but, i, j);
            //teMessage->document()->addResource(QTextDocument::ImageResource, QUrl(but->name()), smiles->copy(j * w, i * h, w, h));
            //teHistory->document()->addResource(QTextDocument::ImageResource, QUrl(but->name()), smiles->copy(j * w, i * h, w, h));
        }
    reloadResource(message());
    smileMenu->setFixedSize(lytSmiles->sizeHint());
    lwHistory->scrollToBottom();

    connect(&tmrNotActive, SIGNAL(timeout()), this, SLOT(slotNotActiveBehav()));
    connect(teMessage, SIGNAL(gotFocus()), this, SLOT(slotFinishReadMessage()));
    connect(teMessage, SIGNAL(lostFocus()), this, SLOT(slotNotActiveBehav()));
}
示例#5
0
void AMGraphicsTextItem::focusInEvent(QFocusEvent *event)
{
	QGraphicsTextItem::focusInEvent(event);
	dontChangeSelection_ = true;
	emit gotFocus(shapeIndex_);
	bool oldValue = blockSignals(true);
	selectAllText();
	blockSignals(oldValue);

}
LoginDialog::LoginDialog(validator_f validator, bool loopMode, QWidget* parent)
	: QDialog(parent)
	, m_validator(validator)
    , m_loopMode(loopMode)
	, m_loginOk(false)
{
	this->setModal(true);
	this->setWindowTitle(QSTRING_FROM_CHARARRAY(_Tr("Login")));

	m_pass = new PasswordInput(this);
    m_pass->setMinimumWidth(200);

    m_buttonBox = new QDialogButtonBox(this);
    m_buttonBox->setOrientation(Qt::Horizontal);
    m_buttonBox->setStandardButtons(/*QDialogButtonBox::Cancel|*/QDialogButtonBox::Ok);

    m_warnImg = new QLabel(this);
    m_warnImg->setPixmap(QPixmap(":/images/exclam.png"));
    m_warnText = new QPlainTextEdit(this);
    m_warnText->setMaximumHeight(100);
    m_warnText->setFrameStyle(QFrame::NoFrame);
    m_warnText->setReadOnly(true);

    // I could not get results by changing the background color in this way (Qt v4.7)
    //
    //m_warnText->setBackgroundRole(QPalette::Window);
    //
    // and this
    //
    //QPalette pal = m_warnText->palette();
    //pal.setColor(m_warnText->foregroundRole(), Qt::blue);
    //m_warnText->setPalette(pal);
    //
    // but works only this way
    QColor bg = this->palette().window().color();
    m_warnText->setStyleSheet(QString("background-color: %1;").arg(bg.name()));

    m_warnText->hide();
    m_warnImg->hide();

	QFormLayout *formLayout = new QFormLayout;
	formLayout->addRow("You are:", new QLabel("anonymous", this));
	formLayout->addRow("Password:", m_pass);
	formLayout->addRow(m_warnImg, m_warnText);
	formLayout->addRow(m_buttonBox);

	formLayout->setSizeConstraint(QLayout::SetFixedSize);
    this->setLayout(formLayout);

	connect(m_buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
	connect(m_pass, SIGNAL(gotFocus()), this, SLOT(clearLoginFailedWarning()));

	this->resize(sizeHint());
}
示例#7
0
IRCViewBox::IRCViewBox(QWidget* parent, Server* newServer)
: QVBox(parent)
{
    m_ircView = new IRCView(this, newServer);
    m_searchBar = new SearchBar(this);
    m_searchBar->hide();
    m_matchedOnce = false;

    connect(m_searchBar, SIGNAL(signalSearchChanged(const QString&)),
        this, SLOT(slotSearchChanged(const QString&)));
    connect(m_searchBar, SIGNAL(signalSearchNext()),
        this, SLOT(slotSearchNext()));
    connect(m_searchBar, SIGNAL(signalSearchPrevious()),
            this, SLOT(slotSearchPrevious()));
    connect(m_ircView, SIGNAL(doSearch()),
        SLOT(slotSearch()));
    connect(m_searchBar, SIGNAL(hidden()), m_ircView, SIGNAL(gotFocus()));
}
示例#8
0
LogfileReader::LogfileReader(QWidget* parent, const QString& log, const QString& caption) : ChatWindow(parent)
{
    setType(ChatWindow::LogFileReader);
    setName(i18n("Logfile of %1", caption));

    fileName = log;

    setSpacing(0);

    toolBar = new KToolBar(this, true, true);
    toolBar->setObjectName("logfile_toolbar");
    toolBar->addAction(QIcon::fromTheme("document-save-as"), i18n("Save As..."), this, SLOT(saveLog()));
    toolBar->addAction(QIcon::fromTheme("view-refresh"), i18n("Reload"), this, SLOT(updateView()));
    toolBar->addAction(QIcon::fromTheme("edit-delete"), i18n("Clear Logfile"), this, SLOT(clearLog()));

    toolBar->addWidget(new QLabel(i18n("Show last:"),toolBar));
    sizeSpin = new QSpinBox(toolBar);
    sizeSpin->setMinimum(10);
    sizeSpin->setMaximum(1000);
    sizeSpin->setSingleStep(10);
    sizeSpin->setObjectName("logfile_size_spinbox");
    sizeSpin->setWhatsThis(i18n("Use this box to set the maximum size of the log file. This setting does not take effect until you restart Konversation. Each log file may have a separate setting."));
    sizeSpin->setValue(Preferences::self()->logfileBufferSize());
    sizeSpin->setSuffix(i18n(" KB"));
    sizeSpin->installEventFilter(this);
    toolBar->addWidget(sizeSpin);
    connect(sizeSpin, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged), this, &LogfileReader::storeBufferSize);

    IRCViewBox* ircBox = new IRCViewBox(this);
    setTextView(ircBox->ircView());
    getTextView()->setWhatsThis(i18n("The messages in the log file are displayed here. The oldest messages are at the top and the most recent are at the bottom."));

    updateView();
    ircBox->ircView()->setFocusPolicy(Qt::StrongFocus);
    setFocusPolicy(Qt::StrongFocus);
    setFocusProxy(ircBox->ircView());

    updateAppearance();

    connect(getTextView(), SIGNAL(gotFocus()), getTextView(), SLOT(setFocus()));
}
示例#9
0
    void Editor::on_proxyMessageReceived(QString msg, QVariant data)
    {
        emit messageReceived(msg, data);

        if(msg == "J_EVT_READY") {
            m_loaded = true;
            emit editorReady();
        } else if(msg == "J_EVT_CONTENT_CHANGED")
            emit contentChanged();
        else if(msg == "J_EVT_CLEAN_CHANGED")
            emit cleanChanged(data.toBool());
        else if(msg == "J_EVT_CURSOR_ACTIVITY")
            emit cursorActivity();
        else if(msg == "J_EVT_GOT_FOCUS")
            emit gotFocus();
        else if(msg == "J_EVT_CURRENT_LANGUAGE_CHANGED") {
            QVariantMap map = data.toMap();
            emit currentLanguageChanged(map.value("id").toString(),
                                        map.value("name").toString());
        }
    }
示例#10
0
void Scene::setActiveObject(QSegMesh* newMesh)
{
	// Delete the original object
	if (activeMesh)
		emit( objectDiscarded( activeMesh->objectName() ) );
		
	// Setup the new object
	activeMesh = newMesh;

	// Controller
	if (!activeMesh->ptr.contains("controller"))
		activeMesh->ptr["controller"] = new Controller(activeMesh);

	// Change title of scene
	setWindowTitle(activeMesh->objectName());

	// Set camera
	resetView();

	// Update the object
	updateActiveObject();

	emit(gotFocus(this));
	emit(objectInserted());

	this->selectMode = CONTROLLER;

	// Check if normalizedf
	double thresh = 1e-6;

	if (abs(newMesh->scaleFactor - 1.0) > thresh || newMesh->translation.norm() > thresh)
	{
		QString message = "WARNING: EXPORT THE (! normalized !) MESH AND RELOAD AGAIN!!!!";
		for(int i = 0; i < 5;i++) print(message);
		displayMessage(message, 5000);
		updateGL();
	}
}
示例#11
0
void aHistLineEdit::focusInEvent(QFocusEvent *)
{
  emit gotFocus();
}
示例#12
0
 void onFocus(wxFocusEvent &evt) { gotFocus(); }
示例#13
0
 void select()
 {
   book->SetSelection(tabNum);
   gotFocus();
 }
示例#14
0
文件: ewidget.cpp 项目: TitanNit/tdt
int eWidget::eventHandler(const eWidgetEvent &evt)
{
	switch (evt.type)
	{
	case eWidgetEvent::childChangedHelpText:
		/* emit */ focusChanged(focus);  // faked focusChanged Signal to the Statusbar
		break;
	case eWidgetEvent::evtAction:
		if (evt.action == shortcut && isVisible())
			(shortcutFocusWidget?shortcutFocusWidget:this)->
				event(eWidgetEvent(eWidgetEvent::evtShortcut));
		else if (evt.action == &i_focusActions->up)
			focusNext(focusDirPrev);
		else if (evt.action == &i_focusActions->down)
			focusNext(focusDirNext);
		else if (evt.action == &i_focusActions->left)
			focusNext(focusDirPrev);
		else if (evt.action == &i_focusActions->right)
			focusNext(focusDirNext);
		else if (evt.action == &i_cursorActions->help)
		{
			int wasvisible=state&stateShow;
			if (wasvisible)
				hide();
			/* emit */ showHelp( &actionHelpList, helpID );
			if (wasvisible)
				show();
		} else
			return 0;
		return 1;
	case eWidgetEvent::evtKey:
	{
		eActionPrioritySet prio;

		findAction(prio, *evt.key, this);

		if (focus && (focus != this))
			focus->findAction(prio, *evt.key, focus);

		for (actionMapList::iterator i = globalActions.begin(); i != globalActions.end(); ++i)
		{
			const std::set<eString> &styles=eActionMapList::getInstance()->getCurrentStyles();
			for (std::set<eString>::const_iterator si(styles.begin()); si != styles.end(); ++si)
				(*i)->findAction(prio, *evt.key, 0, *si);
		}

		for (eActionPrioritySet::iterator i(prio.begin()); i != prio.end(); ++i)
		{
			if (i->first)
			{
				if (((eWidget*)i->first)->event(eWidgetEvent(eWidgetEvent::evtAction, i->second)))
					break;
			} else
			{
				(const_cast<eAction*>(i->second))->handler();	// only useful for global actions
				break;
			}
		}

		if (focus)
		{
			/* Action not found, try to use old Keyhandle */
			int c = evt.key->producer->getKeyCompatibleCode(*evt.key);
			if (c != -1)
			{
				if (evt.key->flags & eRCKey::flagBreak)
					focus->keyUp(c);
				else
					focus->keyDown(c);
			}
		}
		return 1;
		break;
	}
	case eWidgetEvent::gotFocus:
		gotFocus();
		break;
	case eWidgetEvent::lostFocus:
		lostFocus();
		break;
	case eWidgetEvent::changedSize:
	case eWidgetEvent::changedFont:
	case eWidgetEvent::changedPosition:
	case eWidgetEvent::changedPixmap:
		invalidate();
		break;
	case eWidgetEvent::evtShortcut:
			setFocus(this);
		break;
	case eWidgetEvent::wantClose:
/*		if (in_loop==0)
			eFatal("attempt to close non-execing widget");*/
		if (in_loop==1)	// nur wenn das ne echte loop ist
		{
			in_loop=-1;
			eApp->exit_loop();
		}
		result=evt.parameter;
		break;
	default:
		break;
	}
	return 0;
}
示例#15
0
void TextEdit::focusInEvent( QFocusEvent * e)
{
  QTextEdit::focusInEvent(e);
  emit gotFocus();
}
示例#16
0
void LineEdit::focusInEvent( QFocusEvent * e)
{
  QLineEdit::focusInEvent(e);
  emit gotFocus();
}
示例#17
0
void PortComboBox::showPopup(){
	emit gotFocus();
	QComboBox::showPopup();
}
示例#18
0
             SLOT(channelPortChanged(QString))
             );

    connect( ui->horizontalScrollBar, SIGNAL(valueChanged(int)), this, SLOT(scrollData(int)));
    connect( ui->label,               SIGNAL(newSize(QSize)),    this, SLOT(labelResized()) );

    connect( ui->addChannel,          SIGNAL(clicked()),         this, SLOT(addChannel())   );
    connect( ui->deleteChannel,       SIGNAL(clicked()),         this, SLOT(deleteChannel()));

    connect( ui->channelEnable,       SIGNAL(toggled(bool)),     this, SLOT(toggleChannel()));
    connect( ui->channelSetColor,     SIGNAL(clicked()),         this, SLOT(setChannelColor()) );

    connect( ui->snifferStart,        SIGNAL(clicked()),         this, SLOT(startSniffingButt()) );
    connect( ui->retrStart,           SIGNAL(clicked()),         this, SLOT(startRetranslatingButt()) );

    connect( ui->parserEditDummy,     SIGNAL(gotFocus()),        this, SLOT(dummyParseLineEditClicked()) );
    connect( ui->showPreprocessedButt,SIGNAL(clicked()),         this, SLOT(showPreprocessed()) );
    connect( ui->parserSetButt,       SIGNAL(clicked()),         this, SLOT(setParser()) );
    connect( ui->parserSetReparseButt,SIGNAL(clicked()),         this, SLOT(setParserAndReparse()) );
    connect( ui->hideParseEditButt,   SIGNAL(clicked()),         this, SLOT(parseEditorClosed()) );

    connect( &sorter, SIGNAL(gotByte(timestamped_data)), &data_holder, SLOT(receiveByte(timestamped_data)) );

    addTestData();

    ui->expandedParserCont->hide();
    ui->preprocessedParseEditLabel->hide();
    ui->preprocessedParseEdit->hide();

    ui->portTypeComboBox->setEnabled( false );
示例#19
0
void FilterLineEdit::focusInEvent ( QFocusEvent * event ) {
	emit gotFocus();
	QLineEdit::focusInEvent(event);
}