<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[QStyledItemDelegate how to force close the editor?]]></title><description><![CDATA[<p dir="auto">I have an <strong>QTreeView</strong> and when doubleclicking the editor opens.<br />
I want it so when i double click on a certain point of my QTreeview that the editor is closed directly for the index where the index was created.</p>
<p dir="auto">In short im searching for <strong>a way to prevent opening the editor when double clicking on a certain position of my item</strong>. But still the editor should open when clicking elsewhere.</p>
<p dir="auto">How could this be done? Thanks.</p>
<p dir="auto"><img src="https://ddgobkiprc33d.cloudfront.net/d63b2793-58c4-48b4-8a98-bf1c5f5a6f48.png" alt="cf375cad-22cf-4c12-81c4-22f7be862d35-image.png" class=" img-fluid img-markdown" /><br />
<strong>Doubleclicking the checkbox currently is triggering the createEditor of my delegate</strong> i only want <em><strong>the editor to be created when double clicking above the lineEdit</strong></em>. Here is my code:</p>
<p dir="auto">delegate.cpp:</p>
<pre><code>#include "ViewLayerItemDelegate.h"
#include &lt;QStyledItemDelegate&gt;
#include &lt;QPainter&gt;
#include &lt;QApplication&gt;
#include &lt;QItemSelectionModel&gt;
#include &lt;QMouseEvent&gt;
#include "ViewLayerList.h"

#include &lt;QTimer&gt;


ViewLayerItemDelegate::ViewLayerItemDelegate(QObject *parent)
    : QStyledItemDelegate{parent}
{

    
}



QWidget *ViewLayerItemDelegate::createEditor(QWidget *parent, const QStyleOptionViewItem &amp;option, const QModelIndex &amp;index) const
{


    qDebug() &lt;&lt; "Editor created";
    

    LineEditCheckBoxWidget *editor = new LineEditCheckBoxWidget(parent);



   // Verbinden Sie das textChanged() Signal des LineEdits mit Ihrem Slot
    connect(editor-&gt;lineEdit, &amp;QLineEdit::textChanged, this, &amp;ViewLayerItemDelegate::onLineEditTextChanged);
    
    
    
    //Ein Timer um direkt die Editierung des LineEdit zu ermöglichen
    QTimer::singleShot(0, editor-&gt;lineEdit, SLOT(setFocus()));

    

    return editor;

    

}




void ViewLayerItemDelegate::setEditorData(QWidget *editor, const QModelIndex &amp;index) const
{

    
    LineEditCheckBoxWidget *widget = static_cast&lt;LineEditCheckBoxWidget *&gt;(editor);

    // Setzen Sie die Werte der SpinBox und CheckBox basierend auf den Modellwerten
    QString lineEditvalue = index.model()-&gt;data(index, Qt::EditRole).toString();
    bool checkBoxValue = index.model()-&gt;data(index, Qt::CheckStateRole).toBool();

    widget-&gt;lineEdit-&gt;setText(lineEditvalue);
    widget-&gt;checkBox-&gt;setChecked(checkBoxValue);
    
    
    widget-&gt;setFocus();

    widget-&gt;lineEdit-&gt;setFocus(Qt::MouseFocusReason); // Editor aktivieren
    widget-&gt;lineEdit-&gt;setStyleSheet("background: white");
    widget-&gt;iconLabel-&gt;setAttribute(Qt::WA_TranslucentBackground);
   //widget-&gt;setStyleSheet("background: white");
   
   




    // Setzen Sie den bearbeiteten Index
    const_cast&lt;ViewLayerItemDelegate*&gt;(this)-&gt;setCurrentlyEditedIndex(index);
 

    

}




void ViewLayerItemDelegate::setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &amp;index) const
{
    
    
    LineEditCheckBoxWidget *widget = static_cast&lt;LineEditCheckBoxWidget *&gt;(editor);

    

    // Speichern Sie die Werte der SpinBox und CheckBox im Modell
    QString lineEditvalue = widget-&gt;lineEdit-&gt;text();
    bool checkBoxValue = widget-&gt;checkBox-&gt;isChecked();

    model-&gt;setData(index, lineEditvalue, Qt::EditRole);
    model-&gt;setData(index, checkBoxValue ? Qt::Checked : Qt::Unchecked, Qt::CheckStateRole);
    
    qDebug() &lt;&lt; "Model data set";
    


    // Setzen Sie den bearbeiteten Index zurück
    const_cast&lt;ViewLayerItemDelegate*&gt;(this)-&gt;setCurrentlyEditedIndex(QModelIndex());
    
    
   
}




void ViewLayerItemDelegate::updateEditorGeometry(QWidget *editor, const QStyleOptionViewItem &amp;option, const QModelIndex &amp;index) const
{
    editor-&gt;setGeometry(option.rect);
    
}




QSize ViewLayerItemDelegate::sizeHint(const QStyleOptionViewItem &amp;option, const QModelIndex &amp;index) const
{
    
    QSize size = QStyledItemDelegate::sizeHint(option, index);
        size.setHeight(40); // Setzen Sie hier die gewünschte Höhe
        
         // Ändern Sie die Einrückung basierend auf dem Level des Items (z.B., hier um 20 Pixel).
        int indentationLevel = index.column(); // Hier als Beispiel die Einrückung basierend auf der Spalte.
        size.rwidth() -= indentationLevel * 40; // Die Einrückung um 20 Pixel erhöhen.

    return size;
}






void ViewLayerItemDelegate::paint(QPainter *painter, const QStyleOptionViewItem &amp;option, const QModelIndex &amp;index) const
{
    
    
    QStyleOptionViewItem opt = option;
    initStyleOption(&amp;opt, index);


    // Überprüfen Sie, ob der aktuelle Index bearbeitet wird
        if (index == currentlyEditedIndex) {
           
            return;
        }



    // Setzen Sie die Werte der SpinBox und CheckBox basierend auf den Modellwerten
    QString lineEditvalue = index.model()-&gt;data(index, Qt::EditRole).toString();
    bool checkBoxValue = index.model()-&gt;data(index, Qt::CheckStateRole).toBool();






    // Laden Sie das Icon und skalieren Sie es
    QPixmap iconPixmap("://resource/quick.png"); // Ersetzen Sie dies durch den Pfad zu Ihrer Icon-Datei
    QPixmap scaledPixmap = iconPixmap.scaled(32, 32, Qt::KeepAspectRatio, Qt::SmoothTransformation);
    
    // Berechnen Sie die Position für das Icon
    int centerY = option.rect.top() + option.rect.height() / 2;
    int iconY = centerY - scaledPixmap.height() / 2;
    QPoint iconPos = QPoint(option.rect.left() + 10, iconY);
    
    // Zeichnen Sie das Pixmap mit dem QPainter
    painter-&gt;drawPixmap(iconPos, scaledPixmap);


    // Berechnen Sie die Position und Größe für das LineEdit
    QRect lineEditRect = option.rect;
    lineEditRect.setLeft(iconPos.x() + scaledPixmap.width() + 10); // Adjust as needed
    lineEditRect.setRight(option.rect.right() - 10-35); // Adjust as needed



    // Erstellen Sie ein QStyleOptionFrame für das LineEdit
    QStyleOptionFrame lineEditOption;
    lineEditOption.lineWidth = 1; // Setzen Sie die Liniendicke auf 1
    lineEditOption.rect = lineEditRect;

    // Zeichnen Sie das LineEdit
    QApplication::style()-&gt;drawControl(QStyle::CE_ShapedFrame, &amp;lineEditOption, painter);

  // Überprüfen Sie, ob der Text leer ist und zeichnen Sie den Platzhaltertext
 // Zeichnen Sie den Text des LineEdits, considering truncation
// Überprüfen Sie, ob der Text leer ist und zeichnen Sie den Platzhaltertext
    if (lineEditvalue.isEmpty()) {
        painter-&gt;drawText(lineEditOption.rect.adjusted(2, 0, 0, 0), Qt::AlignLeft | Qt::AlignVCenter, "&lt;Empty&gt;");
    } else {
        // Hier wird die maximale Breite des Texts festgelegt, bevor er abgeschnitten wird
        int maxTextWidth = lineEditRect.width();
        
        // Berechnen Sie die Größe des Texts
        QFontMetrics fm(painter-&gt;font());
        QString displayedText = fm.elidedText(lineEditvalue, Qt::ElideRight, maxTextWidth - 10);

        painter-&gt;drawText(lineEditOption.rect.adjusted(2, 0, 0, 0), Qt::AlignLeft | Qt::AlignVCenter, displayedText);
    }

    // Berechnen Sie die Position und Größe für die CheckBox
    QRect checkBoxRect = option.rect;
    checkBoxRect.setLeft(lineEditRect.right() +35- 22); // Adjust as needed
    checkBoxRect.setRight(option.rect.right() - 10); // Adjust as needed

    // Erstellen Sie ein QStyleOptionButton für die CheckBox
    QStyleOptionButton checkBoxOption;
    checkBoxOption.state = checkBoxValue ? QStyle::State_On : QStyle::State_Off;
    checkBoxOption.rect = checkBoxRect;



/* //CODE NUR ZUM VISUELLEN DEBUGGEN DER BEREICHE:
// Zeichnen Sie ein rotes Rechteck um das LineEdit
QPen redPen(Qt::red);
painter-&gt;setPen(redPen);
painter-&gt;drawRect(lineEditRect);


// Zeichnen Sie ein rotes Rechteck um das LineEdit
QPen bluePen(Qt::blue);
painter-&gt;setPen(bluePen);
painter-&gt;drawRect(checkBoxRect);
*/
    // Zeichnen Sie die CheckBox
    QApplication::style()-&gt;drawControl(QStyle::CE_CheckBox, &amp;checkBoxOption, painter);
}






bool ViewLayerItemDelegate::editorEvent(QEvent *event, QAbstractItemModel *model, const QStyleOptionViewItem &amp;option, const QModelIndex &amp;index)
{
    if(event-&gt;type() == QEvent::MouseButtonPress)
    {
        QMouseEvent *mouseEvent = static_cast&lt;QMouseEvent*&gt;(event);
      
        if (const QTreeView* view = qobject_cast&lt;const QTreeView*&gt;(option.widget))
        {
        
        
        const QRect itemRect = view-&gt;visualRect(index);
        ClickPosition = mouseEvent-&gt;position() - itemRect.topLeft(); // press position in item's coords
        
        
        //QRect itemRect = option.rect;
        qDebug() &lt;&lt; "Click position: " &lt;&lt; ClickPosition;
        qDebug() &lt;&lt; "Item Rect: " &lt;&lt;itemRect;


       

        if(ClickPosition.x() &gt;= itemRect.width()-35 &amp;&amp; ClickPosition.x() &lt;= itemRect.width()-20)
        {
        // Invert the state of the checkbox
        bool value = index.data(Qt::CheckStateRole).toBool();
        model-&gt;setData(index, !value, Qt::CheckStateRole);
        
        emit SendCloseEditorToViewLayerList(index);
        
                    

        }
     



        
      }
          
        
        
        

        

      
   }
    
    
    // Standardverhalten beibehalten für andere Ereignisse
    return QStyledItemDelegate::editorEvent(event, model, option, index);
}







// Slot-Implementierung
void ViewLayerItemDelegate::onLineEditTextChanged(const QString &amp;text)
{
    // Hier können Sie die gewünschte Aktion ausführen, wenn der Text im LineEdit bearbeitet wird
    qDebug() &lt;&lt; "LineEdit text changed to:" &lt;&lt; text;
    
 
}









void LineEditCheckBoxWidget::mousePressEvent(QMouseEvent *event)
{
    qDebug() &lt;&lt; "Test clicked";
 this-&gt;lineEdit-&gt;setStyleSheet("background: transparent;");
   

    QWidget::mousePressEvent(event);
}





    
    
    
void ViewLayerItemDelegate::setCurrentlyEditedIndex(const QModelIndex &amp;index)
{
currentlyEditedIndex = index;
}
    

</code></pre>
]]></description><link>https://forum.qt.io/topic/151021/qstyleditemdelegate-how-to-force-close-the-editor</link><generator>RSS for Node</generator><lastBuildDate>Tue, 19 May 2026 02:57:51 GMT</lastBuildDate><atom:link href="https://forum.qt.io/topic/151021.rss" rel="self" type="application/rss+xml"/><pubDate>Sun, 15 Oct 2023 13:18:07 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to QStyledItemDelegate how to force close the editor? on Mon, 16 Oct 2023 14:56:36 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/studentscripter">@<bdi>StudentScripter</bdi></a> said in <a href="/post/776330">QStyledItemDelegate how to force close the editor?</a>:</p>
<blockquote>
<p dir="auto">but sadly this way my delegates editevent logic isnt working anymore when clicking on this area.</p>
</blockquote>
<p dir="auto">What does this mean?<br />
clickPosition is relative to the view, not relative to the current cell (how should it be?).</p>
]]></description><link>https://forum.qt.io/post/776352</link><guid isPermaLink="true">https://forum.qt.io/post/776352</guid><dc:creator><![CDATA[Christian Ehrlicher]]></dc:creator><pubDate>Mon, 16 Oct 2023 14:56:36 GMT</pubDate></item><item><title><![CDATA[Reply to QStyledItemDelegate how to force close the editor? on Mon, 16 Oct 2023 10:02:45 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/christian-ehrlicher">@<bdi>Christian-Ehrlicher</bdi></a> i have overwritten the edit event but how do i prevent or close the createEditor of my delegate? I tried leaving out the call for the edit event in this case, but sadly this way my delegates editevent logic isnt working anymore when clicking on this area.</p>
<pre><code>bool ViewLayerList::edit(const QModelIndex &amp;index, EditTrigger trigger, QEvent *event)
{

      if (event &amp;&amp; (event-&gt;type() == QEvent::MouseButtonPress)) {
        QMouseEvent *mouseEvent = static_cast&lt;QMouseEvent*&gt;(event);
        QPoint clickPosition = mouseEvent-&gt;pos();
        qDebug() &lt;&lt; "EVENT CLICKPOS: " &lt;&lt; clickPosition;
        
        
            QRect itemRect = this-&gt;visualRect(index);
        qDebug() &lt;&lt; "Item size: " &lt;&lt; itemRect.size();
    
         if(clickPosition.x() &gt;= itemRect.width()-30 &amp;&amp; clickPosition.x() &lt;= itemRect.width())
         {
         qDebug() &lt;&lt; "Kein Editor erstellt";
         
         }else if(clickPosition.x() &lt; itemRect.width()-30){
          return QTreeView::edit(index, trigger, event);
         }
        
    }

 
    
   
}


</code></pre>
<p dir="auto"><strong>Alternatively i would like to close the editor here:</strong> (Have a look at the comment)</p>
<pre><code>#include "ViewLayerItemDelegate.h"
#include &lt;QStyledItemDelegate&gt;
#include &lt;QPainter&gt;
#include &lt;QApplication&gt;
#include &lt;QItemSelectionModel&gt;
#include &lt;QMouseEvent&gt;
#include "ViewLayerList.h"

#include &lt;QTimer&gt;


ViewLayerItemDelegate::ViewLayerItemDelegate(QObject *parent)
    : QStyledItemDelegate{parent}
{

    
}



QWidget *ViewLayerItemDelegate::createEditor(QWidget *parent, const QStyleOptionViewItem &amp;option, const QModelIndex &amp;index) const
{


    qDebug() &lt;&lt; "Editor created";
    

    LineEditCheckBoxWidget *editor = new LineEditCheckBoxWidget(parent);



   // Verbinden Sie das textChanged() Signal des LineEdits mit Ihrem Slot
    connect(editor-&gt;lineEdit, &amp;QLineEdit::textChanged, this, &amp;ViewLayerItemDelegate::onLineEditTextChanged);
    
    
    
    //Ein Timer um direkt die Editierung des LineEdit zu ermöglichen
    QTimer::singleShot(0, editor-&gt;lineEdit, SLOT(setFocus()));




    
  
    
    return editor;

    

}




void ViewLayerItemDelegate::setEditorData(QWidget *editor, const QModelIndex &amp;index) const
{

    
    LineEditCheckBoxWidget *widget = static_cast&lt;LineEditCheckBoxWidget *&gt;(editor);

    // Setzen Sie die Werte der SpinBox und CheckBox basierend auf den Modellwerten
    QString lineEditvalue = index.model()-&gt;data(index, Qt::EditRole).toString();
    bool checkBoxValue = index.model()-&gt;data(index, Qt::CheckStateRole).toBool();

    widget-&gt;lineEdit-&gt;setText(lineEditvalue);
    widget-&gt;checkBox-&gt;setChecked(checkBoxValue);
    
    
    //widget-&gt;setFocus();

    //widget-&gt;lineEdit-&gt;setFocus(Qt::MouseFocusReason); // Editor aktivieren
    widget-&gt;lineEdit-&gt;setStyleSheet("background: white");
    widget-&gt;iconLabel-&gt;setAttribute(Qt::WA_TranslucentBackground);
   //widget-&gt;setStyleSheet("background: white");
   
   




    // Setzen Sie den bearbeiteten Index
    const_cast&lt;ViewLayerItemDelegate*&gt;(this)-&gt;setCurrentlyEditedIndex(index);
 

    

}




void ViewLayerItemDelegate::setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &amp;index) const
{
    
    
    LineEditCheckBoxWidget *widget = static_cast&lt;LineEditCheckBoxWidget *&gt;(editor);

    

    // Speichern Sie die Werte der SpinBox und CheckBox im Modell
    QString lineEditvalue = widget-&gt;lineEdit-&gt;text();
    bool checkBoxValue = widget-&gt;checkBox-&gt;isChecked();

    model-&gt;setData(index, lineEditvalue, Qt::EditRole);
    model-&gt;setData(index, checkBoxValue ? Qt::Checked : Qt::Unchecked, Qt::CheckStateRole);
    
    qDebug() &lt;&lt; "Model data set";
    


    // Setzen Sie den bearbeiteten Index zurück
    const_cast&lt;ViewLayerItemDelegate*&gt;(this)-&gt;setCurrentlyEditedIndex(QModelIndex());
    
    
   
}




void ViewLayerItemDelegate::updateEditorGeometry(QWidget *editor, const QStyleOptionViewItem &amp;option, const QModelIndex &amp;index) const
{
    editor-&gt;setGeometry(option.rect);
    
}




QSize ViewLayerItemDelegate::sizeHint(const QStyleOptionViewItem &amp;option, const QModelIndex &amp;index) const
{
    
    QSize size = QStyledItemDelegate::sizeHint(option, index);
        size.setHeight(40); // Setzen Sie hier die gewünschte Höhe
        

    return size;
}






void ViewLayerItemDelegate::paint(QPainter *painter, const QStyleOptionViewItem &amp;option, const QModelIndex &amp;index) const
{
    
    
    QStyleOptionViewItem opt = option;
    initStyleOption(&amp;opt, index);


    // Überprüfen Sie, ob der aktuelle Index bearbeitet wird
        if (index == currentlyEditedIndex) {
           
            return;
        }



    // Setzen Sie die Werte der SpinBox und CheckBox basierend auf den Modellwerten
    QString lineEditvalue = index.model()-&gt;data(index, Qt::EditRole).toString();
    bool checkBoxValue = index.model()-&gt;data(index, Qt::CheckStateRole).toBool();






    // Laden Sie das Icon und skalieren Sie es
    QPixmap iconPixmap("://resource/quick.png"); // Ersetzen Sie dies durch den Pfad zu Ihrer Icon-Datei
    QPixmap scaledPixmap = iconPixmap.scaled(32, 32, Qt::KeepAspectRatio, Qt::SmoothTransformation);
    
    // Berechnen Sie die Position für das Icon
    int centerY = option.rect.top() + option.rect.height() / 2;
    int iconY = centerY - scaledPixmap.height() / 2;
    QPoint iconPos = QPoint(option.rect.left() + 10, iconY);
    
    // Zeichnen Sie das Pixmap mit dem QPainter
    painter-&gt;drawPixmap(iconPos, scaledPixmap);


    // Berechnen Sie die Position und Größe für das LineEdit
    QRect lineEditRect = option.rect;
    lineEditRect.setLeft(iconPos.x() + scaledPixmap.width() + 10); // Adjust as needed
    lineEditRect.setRight(option.rect.right() - 10-35); // Adjust as needed



    // Erstellen Sie ein QStyleOptionFrame für das LineEdit
    QStyleOptionFrame lineEditOption;
    lineEditOption.lineWidth = 1; // Setzen Sie die Liniendicke auf 1
    lineEditOption.rect = lineEditRect;

    // Zeichnen Sie das LineEdit
    QApplication::style()-&gt;drawControl(QStyle::CE_ShapedFrame, &amp;lineEditOption, painter);

  // Überprüfen Sie, ob der Text leer ist und zeichnen Sie den Platzhaltertext
 // Zeichnen Sie den Text des LineEdits, considering truncation
// Überprüfen Sie, ob der Text leer ist und zeichnen Sie den Platzhaltertext
    if (lineEditvalue.isEmpty()) {
        painter-&gt;drawText(lineEditOption.rect.adjusted(2, 0, 0, 0), Qt::AlignLeft | Qt::AlignVCenter, "&lt;Empty&gt;");
    } else {
        // Hier wird die maximale Breite des Texts festgelegt, bevor er abgeschnitten wird
        int maxTextWidth = lineEditRect.width();
        
        // Berechnen Sie die Größe des Texts
        QFontMetrics fm(painter-&gt;font());
        QString displayedText = fm.elidedText(lineEditvalue, Qt::ElideRight, maxTextWidth - 10);

        painter-&gt;drawText(lineEditOption.rect.adjusted(2, 0, 0, 0), Qt::AlignLeft | Qt::AlignVCenter, displayedText);
    }

    // Berechnen Sie die Position und Größe für die CheckBox
    QRect checkBoxRect = option.rect;
    checkBoxRect.setLeft(lineEditRect.right() +35- 22); // Adjust as needed
    checkBoxRect.setRight(option.rect.right() - 10); // Adjust as needed

    // Erstellen Sie ein QStyleOptionButton für die CheckBox
    QStyleOptionButton checkBoxOption;
    checkBoxOption.state = checkBoxValue ? QStyle::State_On : QStyle::State_Off;
    checkBoxOption.rect = checkBoxRect;



/* //CODE NUR ZUM VISUELLEN DEBUGGEN DER BEREICHE:
// Zeichnen Sie ein rotes Rechteck um das LineEdit
QPen redPen(Qt::red);
painter-&gt;setPen(redPen);
painter-&gt;drawRect(lineEditRect);


// Zeichnen Sie ein rotes Rechteck um das LineEdit
QPen bluePen(Qt::blue);
painter-&gt;setPen(bluePen);
painter-&gt;drawRect(checkBoxRect);
*/
    // Zeichnen Sie die CheckBox
    QApplication::style()-&gt;drawControl(QStyle::CE_CheckBox, &amp;checkBoxOption, painter);
}






bool ViewLayerItemDelegate::editorEvent(QEvent *event, QAbstractItemModel *model, const QStyleOptionViewItem &amp;option, const QModelIndex &amp;index)
{
    if(event-&gt;type() == QEvent::MouseButtonPress)
    {
        QMouseEvent *mouseEvent = static_cast&lt;QMouseEvent*&gt;(event);
      
        if (const QTreeView* view = qobject_cast&lt;const QTreeView*&gt;(option.widget))
        {
        
        
        const QRect itemRect = view-&gt;visualRect(index);
        ClickPosition = mouseEvent-&gt;position() - itemRect.topLeft(); // press position in item's coords
        
        
        //QRect itemRect = option.rect;
        qDebug() &lt;&lt; "Click position: " &lt;&lt; ClickPosition;
        qDebug() &lt;&lt; "Item Rect: " &lt;&lt;itemRect;


       

        if(ClickPosition.x() &gt;= itemRect.width()-35 &amp;&amp; ClickPosition.x() &lt;= itemRect.width()-20)
        {
        // Invert the state of the checkbox
        bool value = index.data(Qt::CheckStateRole).toBool();
        model-&gt;setData(index, !value, Qt::CheckStateRole);
        
       
        


        //CLOSE THE EDITOR HERE!!!!!!!!!!!!!!!!!!!


                    

        }
     



        
      }
          
        
        
        

        

      
   }
    
    
    // Standardverhalten beibehalten für andere Ereignisse
    return QStyledItemDelegate::editorEvent(event, model, option, index);
}





</code></pre>
]]></description><link>https://forum.qt.io/post/776330</link><guid isPermaLink="true">https://forum.qt.io/post/776330</guid><dc:creator><![CDATA[StudentScripter]]></dc:creator><pubDate>Mon, 16 Oct 2023 10:02:45 GMT</pubDate></item><item><title><![CDATA[Reply to QStyledItemDelegate how to force close the editor? on Sun, 15 Oct 2023 13:53:06 GMT]]></title><description><![CDATA[<p dir="auto">I don't see a way to achieve this in the delegate - I would override <a href="https://doc.qt.io/qt-6/qabstractitemview.html#edit" target="_blank" rel="noopener noreferrer nofollow ugc">QAIV::edit()</a> and add the appropriate checks in there.</p>
]]></description><link>https://forum.qt.io/post/776238</link><guid isPermaLink="true">https://forum.qt.io/post/776238</guid><dc:creator><![CDATA[Christian Ehrlicher]]></dc:creator><pubDate>Sun, 15 Oct 2023 13:53:06 GMT</pubDate></item></channel></rss>