Exemplo n.º 1
0
DocumentWriterPlugin::DocumentWriterPlugin()
#ifdef SCASE1_PLUGIN_DOCUMENTWRITER_PREDICTION_ENABLED
    : presageCallback(presageStdContext),
      presage(&presageCallback, "plugins/presage/presage.xml")
#endif
{
    QTextCodec::setCodecForLocale(QTextCodec::codecForName("utf-8"));

    browserItemDelegate = NULL;
    rootLevel = NULL;

    autosave = true;

#ifdef SCASE1_PLUGIN_DEBUG_LEVEL_VERBOSE
    qDebug() << "DocumentWriterPlugin::DocumentWriterPlugin:pluginDirPath?" << getPluginPath();
#endif

    settings = new QSettings(getPluginPath() + SCASE1_PLUGIN_DOCUMENTWRITER_SETTINGS_FILE + ".ini", QSettings::IniFormat, this);

    presentationWidget = new DWPTextEdit(settings->value("presentation/ignore_keypresses", false).toBool());

    presentationWidget->setWordWrapMode(QTextOption::WrapAtWordBoundaryOrAnywhere);
    presentationWidget->setUndoRedoEnabled(true);
    presentationWidget->ensureCursorVisible();
    presentationWidget->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);

#ifdef SCASE1_PLUGIN_DOCUMENTWRITER_PREDICTION_ENABLED
    predictedItemsAdded = 0;
#endif

    connect(presentationWidget, SIGNAL(textChanged()), this, SLOT(textHasChanged()));
}
Exemplo n.º 2
0
void text_edit_t::focusOutEvent( QFocusEvent *e)
{
	if( document()->isModified())
	{
		document()->setModified( false);		
		textHasChanged();
	}

	QPlainTextEdit::focusOutEvent( e);
}
Exemplo n.º 3
0
QWidget *se_expr_param_t::do_create_widgets()
{
    QWidget *top = new QWidget();
    QLabel *label = new QLabel( top);
    ui::line_edit_t *tmp = new ui::line_edit_t();
    QSize s = tmp->sizeHint();
    delete tmp;

    label->move( 0, 0);
    label->resize( app().ui()->inspector().left_margin() - 5, s.height());
    label->setAlignment( Qt::AlignRight | Qt::AlignVCenter);
    label->setText( name().c_str());
    label->setToolTip( id().c_str());

    int width = app().ui()->inspector().width() - app().ui()->inspector().left_margin() - 10;
    int height = 0;

    std::string str = get_value<std::string>( *this);
    multi_input_ = new ui::text_edit_t( top);
    multi_input_->move( app().ui()->inspector().left_margin(), height);
    multi_input_->resize( width, s.height() * 7);
    multi_input_->setEnabled( enabled());
    multi_input_->setPlainText( str.c_str());

    multi_input_->setContextMenuPolicy( Qt::CustomContextMenu);
    connect( multi_input_, SIGNAL( textHasChanged()), this, SLOT( text_changed()));
    connect( multi_input_, SIGNAL( customContextMenuRequested( const QPoint&)), this, SLOT( show_context_menu( const QPoint&)));
    height += multi_input_->height();

    top->setMinimumSize( app().ui()->inspector().width(), height);
    top->setMaximumSize( app().ui()->inspector().width(), height);
    top->setSizePolicy( QSizePolicy::Fixed, QSizePolicy::Fixed);

    top_widget_ = top;
    return top;
}