コード例 #1
0
void ImprovedTextEdit::focusInEvent(QFocusEvent *e)
{
    if(e->gotFocus())
    {
        emit receivedFocus();
    }
    QTextEdit::focusInEvent(e);
}
コード例 #2
0
void toEditExtensions::lostFocus(toEditWidget *widget)
{
    if (widget)
    {
        toScintilla *current = dynamic_cast<toScintilla *>(widget);
        if (current && Current == current)
            receivedFocus(NULL);
    }

}
コード例 #3
0
ファイル: chatwindow.cpp プロジェクト: pit-le-rouge/rolisteam
void ChatWindow::setupUi()
{
    // create and connect toggleViewAction
    m_splitter = new QSplitter();
    m_splitter->setOrientation(Qt::Vertical);
    //ChatRoom
    QVBoxLayout * vboxLayout = new QVBoxLayout();
    vboxLayout->setMargin(0);
    vboxLayout->setSpacing(0);

    vboxLayout->addWidget(m_splitter);
    m_displayZone= new ChatBrowser();
    m_displayZone->setOpenExternalLinks(true);
    m_displayZone->setReadOnly(true);
    m_displayZone->setMinimumHeight(30);

    m_editionZone = new ImprovedTextEdit();
    m_editionZone->setReadOnly(false);
    m_editionZone->setMinimumHeight(30);
    m_editionZone->setAcceptRichText(false);
    m_editionZone->installEventFilter(this);

    connect(m_editionZone,SIGNAL(receivedFocus()),this,SLOT(editionGetFocus()));

    // Layout
    m_bottomWidget = new QWidget();
    m_selectPersonComboBox = new QComboBox();
    m_selectPersonComboBox->setModel(&LocalPersonModel::instance());
    m_selectPersonComboBox->setSizeAdjustPolicy(QComboBox::AdjustToContents);

    // Toolbar
    QToolBar * toolBar = new QToolBar();
    toolBar->addWidget(m_selectPersonComboBox);
    QAction* action = toolBar->addAction(QIcon::fromTheme("document-save", QIcon(":/resources/icons/save.png")),tr("save"), this, SLOT(save()));
    action->setToolTip(tr("Save all messages from this window in %1/%2.html").arg(m_preferences->value("ChatDirectory",QDir::homePath()).toString(), m_chat->name()));

    // SelectPersonComboBox
    scheduleUpdateChatMembers();

    QVBoxLayout * internalVLayout = new QVBoxLayout();
    internalVLayout->setMargin(0);
    internalVLayout->setSpacing(0);

    internalVLayout->addWidget(toolBar);
    internalVLayout->addWidget(m_editionZone);
    m_bottomWidget->setLayout(internalVLayout);

    m_splitter->addWidget(m_displayZone);
    m_splitter->addWidget(m_bottomWidget);

    QList<int> tailles;
    tailles.append(200);
    tailles.append(40);
    m_splitter->setSizes(tailles);

    setObjectName("ChatWindow");
    setAttribute(Qt::WA_DeleteOnClose, false);
    setLayout(vboxLayout);

    connect(m_displayZone,SIGNAL(detachView(bool)),this,SLOT(detachView(bool)));

}