Edwin Leuven a écrit :
Abdelrazak Younes wrote:
In principle it should be as easy as replacing QTabularCreate in "qt4/Dialog.C" with your new dialog. Then, to correctly position your
 dialog, you will need to add a method in ControlTabularCreate that
will give the coordinate of toolbar button.

the attached patch is what i came up with.

it works quite well apart from cancelling: i haven't figured out how to
catch mouse events outside the widget (for example on the toolbutton) in
order to close it.

i would greatly appreciate it if someone with some qt knowledge could
have a look at this (i tried the qt-interest list, but haven't received
any clues)

(the contents of the zip here:

http://leuven.ecodip.net/lyx/iconview.zip

allows easy playing around with it)

comments more in general of course appreciated

Here are my comments Edwin...

First I think the LIconview name is not correct. Maybe InsertTableWidget? In any case, please drop the 'L' as we are already in
lyx namespace.
Second, the file name should be the same as the class including the case. So that would be InsertTableWidget.[Ch]

I have to admit I don't like the special code below. Did you try to use the Controller framework instead? I wrote you an email describing what you need to change last week....

Abdel.


Index: src/frontends/qt4/QLToolbar.C
===================================================================
--- src/frontends/qt4/QLToolbar.C       (revision 13913)
+++ src/frontends/qt4/QLToolbar.C       (working copy)
@@ -26,12 +26,13 @@

@@ -239,10 +240,19 @@
                if (owner_.getLyXFunc().getStatus(func).unknown())
                        break;
- QLAction * action = new QLAction(owner_, toolbarbackend.getIcon(func), "", func, tooltip);
-               toolbar_->addAction(action);
-               ActionVector.push_back(action);
-
+               if (func.action==LFUN_TABULAR_INSERT) {
+                       QToolButton * tb = new QToolButton;
+                       
tb->setIcon(QIcon(toolbarbackend.getIcon(func).c_str()));
+                       tb->setToolTip(toqstr(tooltip));
+                       LIconView * iv = new LIconView(tb, owner_, func);
+                       connect(tb, SIGNAL(pressed()), iv, SLOT(show()));
+                       connect(this, SIGNAL(updateChildren()), iv, 
SLOT(updateParent()));
+                       toolbar_->addWidget(tb);
+               } else {
+                       QLAction * action = new QLAction(owner_, 
toolbarbackend.getIcon(func), "", func, tooltip);
+                       toolbar_->addAction(action);
+                       ActionVector.push_back(action);
+               }
                break;
        }
        }
@@ -265,6 +275,8 @@
 {
        for (size_t i=0; i<ActionVector.size(); ++i)
                ActionVector[i]->update();
+
+       emit updateChildren();
 }
Index: src/frontends/qt4/QLToolbar.h
===================================================================
--- src/frontends/qt4/QLToolbar.h       (revision 13913)
+++ src/frontends/qt4/QLToolbar.h       (working copy)
@@ -71,6 +71,8 @@
        void update();
        LayoutBox * layout() const { return layout_.get(); }
+signals:
+       void updateChildren();
 private:
std::vector<QLAction *> ActionVector;

Reply via email to