void QIMPenWidget::resizeEvent( QResizeEvent *e ) { if ( mode == Output ) showCharacter( outputChar, 0 ); QWidget::resizeEvent( e ); }
void character_static(void) { int kb; setCursor(4,3); //케릭터시작위치 while(1) { while(!_kbhit()) { showCharacter(); Sleep(DELAY); } kb=_getch(); switch(kb) { case UP: RemoveCharacter_Set(0,-1); break; case DOWN: RemoveCharacter_Set(0,1); break; case RIGHT: RemoveCharacter_Set(2,0); break; case LEFT: RemoveCharacter_Set(-2,0); break; } } }
MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent) { setWindowTitle("Browzi"); QMenu* fileMenu = menuBar()->addMenu(tr("&File")); fileMenu->addAction(tr("E&xit"), this, SLOT(close()), QKeySequence(Qt::ALT | Qt::Key_F4)); QMenu* viewMenu = menuBar()->addMenu(tr("&View")); viewMenu->addAction(tr("&Font..."), this, SLOT(showFontDialog())); QActionGroup* pinyinGroup = new QActionGroup(this); pa = new QAction("Accented Pinyin",this); pa->setCheckable(true); pinyinGroup->addAction(pa); pn = new QAction("Numbered Pinyin",this); pn->setCheckable(true); pinyinGroup->addAction(pn); connect(pinyinGroup, SIGNAL(triggered(QAction*)), this, SLOT(pinyinDisplayChanged(QAction*))); viewMenu->addSeparator(); viewMenu->addAction(pa); viewMenu->addAction(pn); QMenu* helpMenu = menuBar()->addMenu(tr("&Help")); helpMenu->addAction(tr("Visit &Website"), this, SLOT(goToWebsite())); helpMenu->addAction(tr("&About Browzi"), this, SLOT(showAboutBox())); // Holds all the sub-widgets QWidget* mainPanel = new QWidget(this); // hzLayout has the tabs in the left, the character display in the right QHBoxLayout* hzLayout = new QHBoxLayout(mainPanel); // Set up the search tab tabWidget = new QTabWidget(mainPanel); // Add tabs to the widget SearchRadical* searchByRadical = new SearchRadical(mainPanel); tabWidget->addTab(searchByRadical, QString("Radical")); SearchStrokeCount* searchByStrokeCount = new SearchStrokeCount(); tabWidget->addTab(searchByStrokeCount, QString("Stroke Count")); SearchDraw* searchByDraw = new SearchDraw(tabWidget); tabWidget->addTab(searchByDraw, "Draw"); SearchPinyin* searchPinyin = new SearchPinyin(); tabWidget->addTab(searchPinyin, "Pinyin"); SearchEnglish* searchEnglish = new SearchEnglish(); tabWidget->addTab(searchEnglish, "English"); Clipboard* clipboard = new Clipboard(); tabWidget->addTab(clipboard, "Clipboard"); hzLayout->addWidget(tabWidget); hzLayout->setStretchFactor(tabWidget, 2); // vtLayout contains the character panel, plus a spacer and about button QVBoxLayout* vtLayout = new QVBoxLayout(); displayPanel = new CharacterDisplayPanel(); vtLayout->addWidget(displayPanel); QSpacerItem* verticalSpacer = new QSpacerItem(20, 40, QSizePolicy::Minimum, QSizePolicy::Expanding); vtLayout->addItem(verticalSpacer); hzLayout->addLayout(vtLayout); hzLayout->setStretchFactor(vtLayout, 1); setCentralWidget(mainPanel); // Connect notifications connect(searchByRadical, SIGNAL(showCharacter(uint)), displayPanel, SLOT(setCharacter(uint))); connect(searchByStrokeCount, SIGNAL(showCharacter(uint)), displayPanel, SLOT(setCharacter(uint))); connect(searchByDraw, SIGNAL(showCharacter(uint)), displayPanel, SLOT(setCharacter(uint))); connect(searchPinyin, SIGNAL(showCharacter(uint)), displayPanel, SLOT(setCharacter(uint))); connect(searchEnglish, SIGNAL(showCharacter(uint)), displayPanel, SLOT(setCharacter(uint))); connect(clipboard, SIGNAL(showCharacter(uint)), displayPanel, SLOT(setCharacter(uint))); connect(this, SIGNAL(updateChineseFont(QFont)), searchByDraw, SLOT(setChineseFont(QFont))); connect(this, SIGNAL(updateChineseFont(QFont)), searchByRadical, SLOT(setChineseFont(QFont))); connect(this, SIGNAL(updateChineseFont(QFont)), searchByStrokeCount, SLOT(setChineseFont(QFont))); connect(this, SIGNAL(updateChineseFont(QFont)), searchPinyin, SLOT(setChineseFont(QFont))); connect(this, SIGNAL(updateChineseFont(QFont)), searchEnglish, SLOT(setChineseFont(QFont))); connect(this, SIGNAL(updateChineseFont(QFont)), clipboard, SLOT(setChineseFont(QFont))); connect(this, SIGNAL(updateChineseFont(QFont)), displayPanel, SLOT(setChineseFont(QFont))); connect(tabWidget, SIGNAL(currentChanged(int)), this, SLOT(tabChanged(int))); QSettings s("Browzi", "Browzi"); setGeometry(QRect(s.value("pos", QPoint(200,100)).toPoint(), s.value("size",QSize(600,400)).toSize())); lastFont = QFont(s.value("font","unifont").toString(), 12); emit updateChineseFont(lastFont); PinyinConvertor::Mode m = PinyinConvertor::Mode(s.value("pinyin", 0).toInt()); if(m == PinyinConvertor::PINYIN_ACCENTED) { pa->setChecked(true); PinyinConvertor::setAccented(); } if(m == PinyinConvertor::PINYIN_NUMBERED) { pn->setChecked(true); PinyinConvertor::setNumbered(); } }