PointListView::PointListView( ListWidgetParent* lwParent, QWidget *parent ) : QWidget( parent ), m_listw( lwParent ), m_homeChanged( false ) { setObjectName("PointListView"); QBoxLayout *topLayout = new QVBoxLayout( this ); topLayout->addWidget(m_listw, 10); QBoxLayout *buttonrow=new QHBoxLayout; topLayout->addLayout(buttonrow); QPushButton *cmdClose = new QPushButton(tr("Close"), this); buttonrow->addWidget(cmdClose); QPushButton *cmdInfo = new QPushButton(tr("Info"), this); buttonrow->addWidget(cmdInfo); m_cmdHome = new QPushButton(tr("Home"), this); buttonrow->addWidget(m_cmdHome); m_cmdSelect = new QPushButton(tr("Select"), this); buttonrow->addWidget(m_cmdSelect); connect(m_cmdSelect, SIGNAL(clicked()), this, SLOT(slot_Select())); connect(cmdInfo, SIGNAL(clicked()), this, SLOT(slot_Info())); connect(cmdClose, SIGNAL(clicked()), this, SLOT(slot_Close())); connect(m_cmdHome, SIGNAL(clicked()), this, SLOT(slot_Home())); connect(m_listw, SIGNAL(wpSelectionChanged()), this, SLOT(slot_Selected())); connect(this, SIGNAL(done()), m_listw, SLOT(slot_Done())); // activate keyboard shortcut Return as select QShortcut* scSelect = new QShortcut( this ); scSelect->setKey( Qt::Key_Return ); connect( scSelect, SIGNAL(activated()), this, SLOT( slot_Select() )); }
// create popup menu void TextEditor::CreateMenu ( QWidget * pParent ) { QRect rect; m_pMainMenu = new ZOptionsMenu ( rect, pParent, NULL , 0 , ZSkinService::clsZOptionsMenu); m_pFileMenu = new ZOptionsMenu ( rect, pParent, NULL , 0 , ZSkinService::clsZOptionsMenu); m_pEditMenu = new ZOptionsMenu ( rect, pParent, NULL , 0 , ZSkinService::clsZOptionsMenu); m_pOptionsMenu = new ZOptionsMenu ( rect, pParent, NULL , 0 , ZSkinService::clsZOptionsMenu); m_pNavigateMenu = new ZOptionsMenu ( rect, pParent, NULL , 0 , ZSkinService::clsZOptionsMenu); //*********************************************************************** m_pMainMenu->setItemSpacing ( 10 ); QPixmap* pm = new QPixmap(m_sProgramDir+ IDB_IMAGE_EXIT); //*********************************************************************** m_pFileMenu->setItemSpacing ( 10 ); pm->load(m_sProgramDir+ IDB_IMAGE_NEW); m_pFileMenu->insertItem ( QString( IDS_NEW ), NULL, pm , true , 0 , 0 ); pm->load(m_sProgramDir+ IDB_IMAGE_OPEN); m_pFileMenu->insertItem ( QString( IDS_OPEN ), NULL, pm , true , 1 , 1 ); pm->load(m_sProgramDir+ IDB_IMAGE_SAVE); m_pFileMenu->insertItem ( QString( IDS_SAVE ), NULL, pm , true , 2 , 2 ); pm->load(m_sProgramDir+ IDB_IMAGE_SAVEAS); m_pFileMenu->insertItem ( QString( IDS_SAVEAS ), NULL, pm , true , 3 , 3 ); //------------------------------------------------------------------------ m_pFileMenu->connectItem ( 2, pParent, SLOT ( slot_saveFile() ) ); m_pFileMenu->connectItem ( 3, pParent, SLOT ( slot_saveFileAs() ) ); m_pFileMenu->connectItem ( 1, pParent, SLOT ( slot_openFile() ) ); m_pFileMenu->connectItem ( 0, pParent, SLOT ( slot_newFile() ) ); //*********************************************************************** m_pOptionsMenu->setItemSpacing ( 10 ); //pm->load(m_sProgramDir+ IDB_IMAGE_LANGUAGE); //m_pOptionsMenu->insertItem ( QString( IDS_LANGUAGE ), NULL, pm , true , 0 , 0 ); pm->load(m_sProgramDir+ IDB_IMAGE_TEXTSIZE); m_pOptionsMenu->insertItem ( QString( IDS_TEXTSIZE ), NULL, pm , true , 1 , 1 ); // //------------------------------------------------------------------------ //m_pOptionsMenu->connectItem ( 0, pParent, SLOT ( slot_language() ) ); m_pOptionsMenu->connectItem ( 1, pParent, SLOT ( slot_textSize() ) ); //*********************************************************************** m_pNavigateMenu->setItemSpacing ( 10 ); pm->load(m_sProgramDir+ IDB_IMAGE_ARROW_UP); m_pNavigateMenu->insertItem ( QString( IDS_PAGE_UP ), NULL , pm, true , 0 , 0 ); pm->load(m_sProgramDir+ IDB_IMAGE_ARROW_DOWN); m_pNavigateMenu->insertItem ( QString( IDS_PAGE_DOWN ), NULL, pm, true , 1 , 1 ); pm->load(m_sProgramDir+ IDB_IMAGE_HOME); m_pNavigateMenu->insertItem ( QString( IDS_AT_BEGIN ), NULL, pm , true , 2 , 2 ); pm->load(m_sProgramDir+ IDB_IMAGE_END); m_pNavigateMenu->insertItem ( QString( IDS_AT_END ), NULL, pm , true , 3 , 3 ); //------------------------------------------------------------------------ m_pNavigateMenu->connectItem ( 0, pParent, SLOT ( slot_PageUp() ) ); m_pNavigateMenu->connectItem ( 1, pParent, SLOT ( slot_PageDown() ) ); m_pNavigateMenu->connectItem ( 2, pParent, SLOT ( slot_Home() ) ); m_pNavigateMenu->connectItem ( 3, pParent, SLOT ( slot_End() ) ); //*********************************************************************** m_pEditMenu->setItemSpacing ( 10 ); pm->load(m_sProgramDir+ IDB_IMAGE_COPY); m_pEditMenu->insertItem ( QString( IDS_COPY ), NULL , pm, true , 0 , 0 ); pm->load(m_sProgramDir+ IDB_IMAGE_CUT); m_pEditMenu->insertItem ( QString( IDS_CUT ), NULL, pm , true , 1 , 1 ); pm->load(m_sProgramDir+ IDB_IMAGE_PASTE); m_pEditMenu->insertItem ( QString( IDS_PASTE ), NULL, pm , true , 2 , 2 ); pm->load(m_sProgramDir+ IDB_IMAGE_SELALL); m_pEditMenu->insertItem ( QString( IDS_SELECT_ALL ), NULL, pm , true , 3 , 3 ); //m_pEditMenu->insertSeparator ( 4, 4 ); //pm->load(m_sProgramDir+ IDB_IMAGE_SEARCH); //m_pEditMenu->insertItem ( QString( IDS_SEARCH ), NULL, pm , true , 5 , 5 ); // pm->load(m_sProgramDir+ IDB_IMAGE_BLOCKBEGIN); // m_pEditMenu->insertItem ( QString( IDS_BLOCK_START ), NULL, pm , true , 4 , 4 ); // m_pEditMenu->insertSeparator ( 4, 4 ); // pm->load(m_sProgramDir+ IDB_IMAGE_BLOCKEND); // m_pEditMenu->insertItem ( QString( IDS_BLOCK_END ), NULL, pm , true , 5 , 5 ); //------------------------------------------------------------------------ m_pEditMenu->connectItem ( 0, pParent, SLOT ( slot_Copy() ) ); m_pEditMenu->connectItem ( 1, pParent, SLOT ( slot_Cut() ) ); m_pEditMenu->connectItem ( 2, pParent, SLOT ( slot_Paste() ) ); m_pEditMenu->connectItem ( 3, pParent, SLOT ( slot_selectAll() ) ); // m_pEditMenu->connectItem ( 4, pParent, SLOT ( slot_MarkBegin() ) ); // m_pEditMenu->connectItem ( 5, pParent, SLOT ( slot_MarkEnd() ) ); //m_pEditMenu->connectItem ( 5, pParent, SLOT ( slot_search() ) ); pm->load(m_sProgramDir+ IDB_IMAGE_FILE); m_pMainMenu->insertItem ( QString( IDS_FILE ), m_pFileMenu, pm , true , 0 , 0 ); pm->load(m_sProgramDir+ IDB_IMAGE_NAVIGATE); m_pMainMenu->insertItem ( QString( IDS_NAVIGATION ), m_pNavigateMenu, pm , true , 1 , 1 ); pm->load(m_sProgramDir+ IDB_IMAGE_EDIT); m_pMainMenu->insertItem ( QString( IDS_EDIT ) , m_pEditMenu, pm , true , 2 , 2 ); pm->load(m_sProgramDir+ IDB_IMAGE_OPTIONS); m_pMainMenu->insertItem ( QString( IDS_OPTIONS ), m_pOptionsMenu, pm , true , 3 , 3 ); pm->load(m_sProgramDir+ IDB_IMAGE_ABOUT); m_pMainMenu->insertItem ( QString( IDS_ABOUT ), NULL, pm , true , 4 , 4 ); pm->load(m_sProgramDir+ IDB_IMAGE_EXIT); m_pMainMenu->insertItem ( QString( IDS_EXIT ), NULL , pm, true , 5 , 5 ); //------------------------------------------------------------------------ m_pMainMenu->connectItem ( 5, qApp, SLOT ( quit() ) ); m_pMainMenu->connectItem ( 4, pParent, SLOT ( slot_about() ) ); }