mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-18 00:03:05 -04:00
Followup bad94e0
This commit is contained in:
parent
34f00d106f
commit
0f8fef1203
@ -8,6 +8,11 @@ class QgsCodeEditor: QsciScintilla
|
|||||||
QgsCodeEditor( QWidget *parent /TransferThis/ = 0, QString title = "" , bool folding = false, bool margin = false );
|
QgsCodeEditor( QWidget *parent /TransferThis/ = 0, QString title = "" , bool folding = false, bool margin = false );
|
||||||
~QgsCodeEditor();
|
~QgsCodeEditor();
|
||||||
|
|
||||||
|
/** Set the widget title
|
||||||
|
* @param title widget title
|
||||||
|
*/
|
||||||
|
void setTitle( const QString title );
|
||||||
|
|
||||||
/** Set margin visible state
|
/** Set margin visible state
|
||||||
* @param margin Set margin in the editor
|
* @param margin Set margin in the editor
|
||||||
*/
|
*/
|
||||||
@ -19,4 +24,16 @@ class QgsCodeEditor: QsciScintilla
|
|||||||
*/
|
*/
|
||||||
void setFoldingVisible( bool folding);
|
void setFoldingVisible( bool folding);
|
||||||
bool foldingVisible();
|
bool foldingVisible();
|
||||||
|
|
||||||
|
/** Insert text at cursor position, or replace any selected text if user has
|
||||||
|
* made a selection.
|
||||||
|
* @param theText The text to be inserted
|
||||||
|
*/
|
||||||
|
void insertText( const QString theText );
|
||||||
|
|
||||||
|
protected:
|
||||||
|
|
||||||
|
bool isFixedPitch( const QFont& font );
|
||||||
|
|
||||||
|
QFont getMonospaceFont();
|
||||||
};
|
};
|
||||||
|
@ -67,7 +67,7 @@ void QgsCodeEditor::setSciWidget()
|
|||||||
setAutoCompletionSource( QsciScintilla::AcsAPIs );
|
setAutoCompletionSource( QsciScintilla::AcsAPIs );
|
||||||
}
|
}
|
||||||
|
|
||||||
void QgsCodeEditor::setTitle( QString title )
|
void QgsCodeEditor::setTitle( const QString title )
|
||||||
{
|
{
|
||||||
setWindowTitle( title );
|
setWindowTitle( title );
|
||||||
}
|
}
|
||||||
@ -106,12 +106,20 @@ void QgsCodeEditor::setFoldingVisible( bool folding )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void QgsCodeEditor::insertText( QString theText )
|
void QgsCodeEditor::insertText( const QString theText )
|
||||||
{
|
{
|
||||||
|
// Insert the text or replace selected text
|
||||||
|
if ( hasSelectedText() )
|
||||||
|
{
|
||||||
|
replaceSelectedText( theText );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
int line, index;
|
int line, index;
|
||||||
getCursorPosition( &line, &index );
|
getCursorPosition( &line, &index );
|
||||||
insertAt( theText, line, index );
|
insertAt( theText, line, index );
|
||||||
setCursorPosition( line, index + theText.length() );
|
setCursorPosition( line, index + theText.length() );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Settings for font and fontsize
|
// Settings for font and fontsize
|
||||||
|
@ -45,8 +45,10 @@ class GUI_EXPORT QgsCodeEditor : public QsciScintilla
|
|||||||
QgsCodeEditor( QWidget *parent = 0, QString title = "" , bool folding = false, bool margin = false );
|
QgsCodeEditor( QWidget *parent = 0, QString title = "" , bool folding = false, bool margin = false );
|
||||||
~QgsCodeEditor();
|
~QgsCodeEditor();
|
||||||
|
|
||||||
/** Set the widget title */
|
/** Set the widget title
|
||||||
void setTitle( QString );
|
* @param title widget title
|
||||||
|
*/
|
||||||
|
void setTitle( const QString title );
|
||||||
|
|
||||||
/** Set margin visible state
|
/** Set margin visible state
|
||||||
* @param margin Set margin in the editor
|
* @param margin Set margin in the editor
|
||||||
@ -60,10 +62,11 @@ class GUI_EXPORT QgsCodeEditor : public QsciScintilla
|
|||||||
void setFoldingVisible( bool folding );
|
void setFoldingVisible( bool folding );
|
||||||
bool foldingVisible() { return mFolding; }
|
bool foldingVisible() { return mFolding; }
|
||||||
|
|
||||||
/** Isert text at cursor position
|
/** Insert text at cursor position, or replace any selected text if user has
|
||||||
|
* made a selection.
|
||||||
* @param theText The text to be inserted
|
* @param theText The text to be inserted
|
||||||
*/
|
*/
|
||||||
void insertText( QString theText );
|
void insertText( const QString theText );
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
|
@ -92,7 +92,7 @@ QgsExpressionBuilderWidget::QgsExpressionBuilderWidget( QWidget *parent )
|
|||||||
QString name = func->name();
|
QString name = func->name();
|
||||||
if ( name.startsWith( "_" ) ) // do not display private functions
|
if ( name.startsWith( "_" ) ) // do not display private functions
|
||||||
continue;
|
continue;
|
||||||
if ( func->params() >= 1 )
|
if ( func->params() != 0 )
|
||||||
name += "(";
|
name += "(";
|
||||||
registerItem( func->group(), func->name(), " " + name + " ", func->helptext() );
|
registerItem( func->group(), func->name(), " " + name + " ", func->helptext() );
|
||||||
}
|
}
|
||||||
@ -157,7 +157,7 @@ void QgsExpressionBuilderWidget::on_expressionTree_doubleClicked( const QModelIn
|
|||||||
if ( item->getItemType() == QgsExpressionItem::Header )
|
if ( item->getItemType() == QgsExpressionItem::Header )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Insert the expression text.
|
// Insert the expression text or replace selected text
|
||||||
txtExpressionString->insertText( item->getExpressionText() );
|
txtExpressionString->insertText( item->getExpressionText() );
|
||||||
txtExpressionString->setFocus();
|
txtExpressionString->setFocus();
|
||||||
}
|
}
|
||||||
@ -392,6 +392,7 @@ void QgsExpressionBuilderWidget::on_lblPreview_linkActivated( QString link )
|
|||||||
|
|
||||||
void QgsExpressionBuilderWidget::on_mValueListWidget_itemDoubleClicked( QListWidgetItem *item )
|
void QgsExpressionBuilderWidget::on_mValueListWidget_itemDoubleClicked( QListWidgetItem *item )
|
||||||
{
|
{
|
||||||
|
// Insert the item text or replace selected text
|
||||||
txtExpressionString->insertText( " " + item->text() + " " );
|
txtExpressionString->insertText( " " + item->text() + " " );
|
||||||
txtExpressionString->setFocus();
|
txtExpressionString->setFocus();
|
||||||
}
|
}
|
||||||
@ -399,6 +400,8 @@ void QgsExpressionBuilderWidget::on_mValueListWidget_itemDoubleClicked( QListWid
|
|||||||
void QgsExpressionBuilderWidget::operatorButtonClicked()
|
void QgsExpressionBuilderWidget::operatorButtonClicked()
|
||||||
{
|
{
|
||||||
QPushButton* button = dynamic_cast<QPushButton*>( sender() );
|
QPushButton* button = dynamic_cast<QPushButton*>( sender() );
|
||||||
|
|
||||||
|
// Insert the button text or replace selected text
|
||||||
txtExpressionString->insertText( " " + button->text() + " " );
|
txtExpressionString->insertText( " " + button->text() + " " );
|
||||||
txtExpressionString->setFocus();
|
txtExpressionString->setFocus();
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user