mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2025-12-18 05:00:33 +01:00
add condition to enable the richtext menu entry
git-svn-id: svn+ssh://svn.tuxfamily.org/svnroot/qet/qet/trunk@2180 bfdf4180-ca20-0410-9c96-a3a8aa849046
This commit is contained in:
@@ -1066,6 +1066,20 @@ QSet<DiagramTextItem *> Diagram::selectedTexts() const {
|
||||
return(selected_texts);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Diagram::selectedConductorTexts
|
||||
* @return the list of conductor texts selected
|
||||
*/
|
||||
QSet<ConductorTextItem *> Diagram::selectedConductorTexts() const {
|
||||
QSet<ConductorTextItem *> selected_texts;
|
||||
foreach(QGraphicsItem *item, selectedItems()) {
|
||||
if (ConductorTextItem *cti = qgraphicsitem_cast<ConductorTextItem *>(item)) {
|
||||
selected_texts << cti;
|
||||
}
|
||||
}
|
||||
return(selected_texts);
|
||||
}
|
||||
|
||||
/// @return true si le presse-papier semble contenir un schema
|
||||
bool Diagram::clipboardMayContainDiagram() {
|
||||
QString clipboard_text = QApplication::clipboard() -> text().trimmed();
|
||||
|
||||
@@ -39,6 +39,7 @@ class ElementTextsMover;
|
||||
class IndependentTextItem;
|
||||
class QETProject;
|
||||
class Terminal;
|
||||
class ConductorTextItem;
|
||||
/**
|
||||
This class represents an electric diagram. It manages its various child
|
||||
elements, conductors and texts and handles their graphic rendering.
|
||||
@@ -162,6 +163,7 @@ class Diagram : public QGraphicsScene {
|
||||
|
||||
QList<CustomElement *> customElements() const;
|
||||
QSet<DiagramTextItem *> selectedTexts() const;
|
||||
QSet<ConductorTextItem *> selectedConductorTexts() const;
|
||||
QSet<Conductor *> selectedConductors() const;
|
||||
DiagramContent content() const;
|
||||
DiagramContent selectedContent();
|
||||
|
||||
@@ -1201,9 +1201,10 @@ void QETDiagramEditor::slot_updateComplexActions() {
|
||||
prj_diagramNum -> setEnabled(editable_diagram);
|
||||
|
||||
// actions ayant besoin de textes selectionnes
|
||||
bool selected_texts = dv ? (dv -> diagram() -> selectedTexts().count()) : 0;
|
||||
int selected_texts = dv ? (dv -> diagram() -> selectedTexts().count()) : 0;
|
||||
int selected_conductor_texts = dv ? (dv -> diagram() -> selectedConductorTexts().count()) : 0;
|
||||
rotate_texts -> setEnabled(editable_diagram && selected_texts);
|
||||
add_edittext -> setEnabled(editable_diagram && selected_texts);
|
||||
add_edittext -> setEnabled(editable_diagram && selected_texts == 1 && !selected_conductor_texts);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user