383
383
// Atom atom_task = XInternAtom(QX11Info::display (),"_NET_WM_STATE_SKIP_TASKBAR",False);
384
384
// Atom atom = XInternAtom(dis,"_NET_WM_STATE",False);
385
385
// XChangeProperty(dis,winId(),atom,XA_ATOM,32,PropModeAppend,(unsigned char *)&atom_task,1);
388
390
ChineseCalendar::~ChineseCalendar()
390
392
delete mycalendat;
395
void ChineseCalendar::createTray()
397
this->actionShow = new QAction(tr("隐藏/显示"), this);
398
connect(actionShow, SIGNAL(triggered()), this, SLOT(showOrHide()));
400
this->actionStaysOnTop = new QAction(tr("总在最前"), this);
401
this->actionStaysOnTop->setCheckable(true);
402
connect(actionStaysOnTop, SIGNAL(triggered()), this, SLOT(setMode()));
404
this->actionStaysOnBottom = new QAction(tr("总在最后"), this);
405
this->actionStaysOnBottom->setCheckable(true);
406
connect(actionStaysOnBottom, SIGNAL(triggered()), this, SLOT(setMode()));
408
this->actionStaysNormal = new QAction(tr("普通模式"), this);
409
this->actionStaysNormal->setCheckable(true);
410
this->actionStaysNormal->setChecked(true);
411
connect(actionStaysNormal, SIGNAL(triggered()), this, SLOT(setMode()));
413
this->ag = new QActionGroup(this);
414
this->ag->addAction(actionStaysOnTop);
415
this->ag->addAction(actionStaysOnBottom);
416
this->ag->addAction(actionStaysNormal);
418
this->actionQuit = new QAction(tr("退出程序"), this);
419
connect(actionQuit, SIGNAL(triggered()), qApp, SLOT(quit()));
421
this->trayMenu = new QMenu(this);
422
this->trayMenu->addAction(actionShow);
423
this->trayMenu->addSeparator();
424
this->trayMenu->addAction(actionStaysOnTop);
425
this->trayMenu->addAction(actionStaysOnBottom);
426
this->trayMenu->addAction(actionStaysNormal);
427
this->trayMenu->addSeparator();
428
this->trayMenu->addAction(actionQuit);
430
this->trayIcon = new QSystemTrayIcon(this);
431
this->trayIcon->setIcon(QIcon(":/img/chinesecalendar.png"));
432
this->trayIcon->setContextMenu(trayMenu);
433
this->trayIcon->show();
393
436
void ChineseCalendar::paintEvent(QPaintEvent *)
395
438
QPainter painter(this);
749
792
YearSelect->setDate(selectedDate.addYears(1));
795
void ChineseCalendar::showOrHide()
804
void ChineseCalendar::setMode()
806
if(this->actionStaysOnTop->isChecked())
808
this->setWindowFlags(Qt::ToolTip | Qt::FramelessWindowHint);
810
} else if(this->actionStaysOnBottom->isChecked())
812
this->setWindowFlags(Qt::WindowStaysOnBottomHint | Qt::FramelessWindowHint);
816
this->setWindowFlags(Qt::FramelessWindowHint);