]> git.lyx.org Git - lyx.git/blobdiff - src/frontends/qt/GuiCitation.cpp
Make string-widget combination more l7n friendly
[lyx.git] / src / frontends / qt / GuiCitation.cpp
index 4f34a0fa1abc8d1baf20f067be3e292b36e03bba..c5fa26631098b17c331d78b0fc71ea603b2b0c45 100644 (file)
 #include "FancyLineEdit.h"
 #include "GuiApplication.h"
 #include "GuiSelectionManager.h"
+#include "GuiView.h"
 #include "qt_helpers.h"
 
 #include "Buffer.h"
 #include "BufferView.h"
 #include "BufferParams.h"
 #include "Citation.h"
+#include "Cursor.h"
 #include "TextClass.h"
 #include "FuncRequest.h"
 
@@ -96,10 +98,7 @@ GuiCitation::GuiCitation(GuiView & lv)
 
        // The filter bar
        filter_ = new FancyLineEdit(this);
-       filter_->setButtonPixmap(FancyLineEdit::Right, getPixmap("images/", "editclear", "svgz,png"));
-       filter_->setButtonVisible(FancyLineEdit::Right, true);
-       filter_->setButtonToolTip(FancyLineEdit::Right, qt_("Clear text"));
-       filter_->setAutoHideButton(FancyLineEdit::Right, true);
+       filter_->setClearButton(true);
        filter_->setPlaceholderText(qt_("All avail. citations"));
 
        filterBarL->addWidget(filter_, 0);
@@ -141,6 +140,8 @@ GuiCitation::GuiCitation(GuiView & lv)
                        addPB, deletePB, upPB, downPB, &available_model_, &selected_model_, 1);
        connect(selectionManager, SIGNAL(selectionChanged()),
                this, SLOT(setCitedKeys()));
+       connect(selectionManager, SIGNAL(updateHook()),
+               this, SLOT(setCitedKeys()));
        connect(selectionManager, SIGNAL(updateHook()),
                this, SLOT(updateControls()));
        connect(selectionManager, SIGNAL(okHook()),
@@ -152,13 +153,8 @@ GuiCitation::GuiCitation(GuiView & lv)
                this, SLOT(filterChanged(QString)));
        connect(filter_, SIGNAL(returnPressed()),
                this, SLOT(filterPressed()));
-#if (QT_VERSION < 0x050000)
-       connect(filter_, SIGNAL(downPressed()),
-               availableLV, SLOT(setFocus()));
-#else
        connect(filter_, &FancyLineEdit::downPressed,
-               availableLV, [=](){ focusAndHighlight(availableLV); });
-#endif
+               availableLV, [this](){ focusAndHighlight(availableLV); });
        connect(regexp_, SIGNAL(triggered()),
                this, SLOT(regexChanged()));
        connect(casesense_, SIGNAL(triggered()),
@@ -166,11 +162,7 @@ GuiCitation::GuiCitation(GuiView & lv)
        connect(instant_, SIGNAL(triggered(bool)),
                this, SLOT(instantChanged(bool)));
 
-#if (QT_VERSION < 0x050000)
-       selectedLV->horizontalHeader()->setResizeMode(QHeaderView::Stretch);
-#else
        selectedLV->horizontalHeader()->setSectionResizeMode(QHeaderView::Stretch);
-#endif
 
        selectedLV->setToolTip(qt_("Ordered list of all cited references.\n"
                                   "You can reorder, add and remove references with the buttons on the left."));
@@ -196,6 +188,7 @@ void GuiCitation::applyView()
        QString const after = textAfterED->text();
 
        applyParams(choice, full, force, before, after);
+       connectToNewInset();
 }
 
 
@@ -1101,9 +1094,6 @@ void GuiCitation::restoreSession()
 }
 
 
-Dialog * createGuiCitation(GuiView & lv) { return new GuiCitation(lv); }
-
-
 } // namespace frontend
 } // namespace lyx