This commit is contained in:
Yannick Verdie 2010-08-18 14:45:38 +00:00
parent 94b588099c
commit 8ada1da08c
2 changed files with 93 additions and 9 deletions

View File

@ -1014,7 +1014,7 @@ void GuiReceiver::addButton(QString button_name, int button_type, int initial_bu
{
b = CvWindow::createButtonbar(button_name);//the bar has the name of the first button attached to it
//enablePropertiesButtonEachWindow();
enablePropertiesButtonEachWindow();
}else{
CvBar* lastbar = (CvBar*) global_control_panel->myLayout->itemAt(global_control_panel->myLayout->count()-1);
@ -1460,7 +1460,9 @@ CvWindow::CvWindow(QString arg, int arg2)
createView(mode_display, param_ratio_mode);
//4: shortcuts and actions
createActionsandShortcuts();
createActions();
createShortcuts();
//createActionsandShortcuts();
//5: toolBar and statusbar
if (param_gui_mode == CV_GUI_EXPANDED)
@ -1581,6 +1583,7 @@ void CvWindow::displayPropertiesWin()
global_control_panel->hide();
}
/*
void CvWindow::createActionsandShortcuts()
{
vect_QActions.resize(10);
@ -1637,11 +1640,91 @@ void CvWindow::createActionsandShortcuts()
vect_QActions[9]->setIconVisibleInMenu(true);
vect_QActions[9]->setShortcut(shortcut_properties_win);
//if (global_control_panel->myLayout->count() == 0)
// vect_QActions[9]->setDisabled(true);
if (global_control_panel->myLayout->count() == 0)
vect_QActions[9]->setDisabled(true);
QObject::connect( vect_QActions[9],SIGNAL(triggered()),this, SLOT( displayPropertiesWin() ));
}*/
void CvWindow::createActions()
{
vect_QActions.resize(10);
//if the shortcuts are changed in window_QT.h, we need to update the tooltip manually
vect_QActions[0] = new QAction(QIcon(":/left-icon"),"Panning left (CTRL+arrowLEFT)",this);
vect_QActions[0]->setIconVisibleInMenu(true);
QObject::connect( vect_QActions[0],SIGNAL(triggered()),myview, SLOT( siftWindowOnLeft() ));
vect_QActions[1] = new QAction(QIcon(":/right-icon"),"Panning right (CTRL+arrowRIGHT)",this);
vect_QActions[1]->setIconVisibleInMenu(true);
QObject::connect( vect_QActions[1],SIGNAL(triggered()),myview, SLOT( siftWindowOnRight() ));
vect_QActions[2] = new QAction(QIcon(":/up-icon"),"Panning up (CTRL+arrowUP)",this);
vect_QActions[2]->setIconVisibleInMenu(true);
QObject::connect( vect_QActions[2],SIGNAL(triggered()),myview, SLOT( siftWindowOnUp() ));
vect_QActions[3] = new QAction(QIcon(":/down-icon"),"Panning down (CTRL+arrowDOWN)",this);
vect_QActions[3]->setIconVisibleInMenu(true);
QObject::connect( vect_QActions[3],SIGNAL(triggered()),myview, SLOT( siftWindowOnDown() ));
vect_QActions[4] = new QAction(QIcon(":/zoom_x1-icon"),"Zoom x1 (CTRL+P)",this);
vect_QActions[4]->setIconVisibleInMenu(true);
QObject::connect( vect_QActions[4],SIGNAL(triggered()),myview, SLOT( resetZoom() ));
vect_QActions[5] = new QAction(QIcon(":/imgRegion-icon"),tr("Zoom x%1 (see label) (CTRL+X)")
.arg(threshold_zoom_img_region)
,this);
vect_QActions[5]->setIconVisibleInMenu(true);
QObject::connect( vect_QActions[5],SIGNAL(triggered()),myview, SLOT( imgRegion() ));
vect_QActions[6] = new QAction(QIcon(":/zoom_in-icon"),tr("Zoom in (CTRL++)"),this);
vect_QActions[6]->setIconVisibleInMenu(true);
QObject::connect( vect_QActions[6],SIGNAL(triggered()),myview, SLOT( ZoomIn() ));
vect_QActions[7] = new QAction(QIcon(":/zoom_out-icon"),tr("Zoom out (CTRL+-)"),this);
vect_QActions[7]->setIconVisibleInMenu(true);
QObject::connect( vect_QActions[7],SIGNAL(triggered()),myview, SLOT( ZoomOut() ));
vect_QActions[8] = new QAction(QIcon(":/save-icon"),tr("Save current image (CTRL+S)"),this);
vect_QActions[8]->setIconVisibleInMenu(true);
QObject::connect( vect_QActions[8],SIGNAL(triggered()),myview, SLOT( saveView() ));
vect_QActions[9] = new QAction(QIcon(":/properties-icon"),tr("Display properties window (CTRL+P)"),this);
vect_QActions[9]->setIconVisibleInMenu(true);
QObject::connect( vect_QActions[9],SIGNAL(triggered()),this, SLOT( displayPropertiesWin() ));
if (global_control_panel->myLayout->count() == 0)
vect_QActions[9]->setDisabled(true);
}
void CvWindow::createShortcuts()
{
vect_QShortcuts.resize(10);
vect_QShortcuts[0] = new QShortcut(shortcut_panning_left, this);
QObject::connect( vect_QShortcuts[0], SIGNAL( activated ()),myview, SLOT( siftWindowOnLeft() ));
vect_QShortcuts[1] = new QShortcut(shortcut_panning_right, this);
QObject::connect( vect_QShortcuts[1], SIGNAL( activated ()),myview, SLOT( siftWindowOnRight() ));
vect_QShortcuts[2] = new QShortcut(shortcut_panning_up, this);
QObject::connect(vect_QShortcuts[2], SIGNAL( activated ()),myview, SLOT( siftWindowOnUp() ));
vect_QShortcuts[3] = new QShortcut(shortcut_panning_down, this);
QObject::connect(vect_QShortcuts[3], SIGNAL( activated ()),myview, SLOT( siftWindowOnDown() ));
vect_QShortcuts[4] = new QShortcut(shortcut_zoom_normal, this);
QObject::connect( vect_QShortcuts[4], SIGNAL( activated ()),myview, SLOT( resetZoom( ) ));
vect_QShortcuts[5] = new QShortcut(shortcut_zoom_imgRegion, this);
QObject::connect( vect_QShortcuts[5], SIGNAL( activated ()),myview, SLOT( imgRegion( ) ));
vect_QShortcuts[6] = new QShortcut(shortcut_zoom_in, this);
QObject::connect( vect_QShortcuts[6], SIGNAL( activated ()),myview, SLOT( ZoomIn() ));
vect_QShortcuts[7] = new QShortcut(shortcut_zoom_out, this);
QObject::connect(vect_QShortcuts[7], SIGNAL( activated ()),myview, SLOT( ZoomOut() ));
vect_QShortcuts[8] = new QShortcut(shortcut_save_img, this);
QObject::connect( vect_QShortcuts[8], SIGNAL( activated ()),myview, SLOT( saveView( ) ));
vect_QShortcuts[9] = new QShortcut(shortcut_properties_win, this);
QObject::connect( vect_QShortcuts[9], SIGNAL( activated ()),this, SLOT( displayPropertiesWin() ));
}
void CvWindow::createToolBar()
@ -1745,8 +1828,8 @@ void CvWindow::addSlider2(CvWindow* w,QString name, int* value, int count,CvTrac
myLayout = global_control_panel->myLayout;
//if first one, enable control panel
//if (myLayout->count() == 0)
// guiMainThread->enablePropertiesButtonEachWindow();
if (myLayout->count() == 0)
guiMainThread->enablePropertiesButtonEachWindow();
}
myLayout->insertLayout( myLayout->count(),t);
@ -1771,8 +1854,8 @@ void CvWindow::addSlider(CvWindow* w,QString name, int* value, int count,CvTrack
myLayout = global_control_panel->myLayout;
//if first one, enable control panel
//if (myLayout->count() == 0)
// guiMainThread->enablePropertiesButtonEachWindow();
if (myLayout->count() == 0)
guiMainThread->enablePropertiesButtonEachWindow();
}
myLayout->insertLayout( myLayout->count(),t);

View File

@ -330,7 +330,8 @@ private:
void icvLoadButtonbar(CvButtonbar* t,QSettings *settings);
void icvSaveButtonbar(CvButtonbar* t,QSettings *settings);
void createActionsandShortcuts();
void createActions();
void createShortcuts();
void createToolBar();
void createView(int display_mode, int ratio_mode);
void createStatusBar();