Changeset 35


Ignore:
Timestamp:
05/27/08 14:49:14 (4 years ago)
Author:
antonbatenev.ya.ru
Message:

fix #2 - кнопки выбора и отмены выделения всех форумов на форме подписки.

Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/form_subscribe.cpp

    r20 r35  
    1919FormSubscribe::FormSubscribe (QWidget* parent) :  FormSubscribeUI (parent) 
    2020{ 
    21         connect(button_ok,      SIGNAL(clicked()), this, SLOT(button_ok_clicked())); 
    22         connect(button_refresh, SIGNAL(clicked()), this, SLOT(button_refresh_clicked())); 
    23         connect(button_cancel,  SIGNAL(clicked()), this, SLOT(reject())); 
     21        connect(button_ok,          SIGNAL(clicked()), this, SLOT(button_ok_clicked())); 
     22        connect(button_refresh,     SIGNAL(clicked()), this, SLOT(button_refresh_clicked())); 
     23        connect(button_select_all,  SIGNAL(clicked()), this, SLOT(button_select_all_clicked())); 
     24        connect(button_select_none, SIGNAL(clicked()), this, SLOT(button_select_none_clicked())); 
     25        connect(button_cancel,      SIGNAL(clicked()), this, SLOT(reject())); 
    2426 
    2527        // загрузка дерева 
     
    190192} 
    191193//---------------------------------------------------------------------------------------------- 
     194 
     195void FormSubscribe::button_select_all_clicked () 
     196{ 
     197        for (int group_index = 0; group_index < tree_forum->topLevelItemCount(); group_index++) 
     198        { 
     199                QTreeWidgetItem* group_item = tree_forum->topLevelItem(group_index); 
     200 
     201                for (int forum_index = 0; forum_index < group_item->childCount(); forum_index++) 
     202                { 
     203                        QTreeWidgetItem* forum_item = group_item->child(forum_index); 
     204                        forum_item->setCheckState(0, Qt::Checked); 
     205                } 
     206        } 
     207} 
     208//---------------------------------------------------------------------------------------------- 
     209 
     210void FormSubscribe::button_select_none_clicked () 
     211{ 
     212        for (int group_index = 0; group_index < tree_forum->topLevelItemCount(); group_index++) 
     213        { 
     214                QTreeWidgetItem* group_item = tree_forum->topLevelItem(group_index); 
     215 
     216                for (int forum_index = 0; forum_index < group_item->childCount(); forum_index++) 
     217                { 
     218                        QTreeWidgetItem* forum_item = group_item->child(forum_index); 
     219                        forum_item->setCheckState(0, Qt::Unchecked); 
     220                } 
     221        } 
     222} 
     223//---------------------------------------------------------------------------------------------- 
  • trunk/form_subscribe.h

    r14 r35  
    2929 
    3030                // ОК 
    31                 void button_ok_clicked      (); 
     31                void button_ok_clicked (); 
    3232                // Отмена 
    3333                void button_refresh_clicked (); 
     34                // выбрать все 
     35                void button_select_all_clicked (); 
     36                // отменить все 
     37                void button_select_none_clicked (); 
    3438}; 
    3539//---------------------------------------------------------------------------------------------- 
  • trunk/form_subscribe_ui.cpp

    r7 r35  
    4242        layout_button->addWidget(button_refresh); 
    4343 
     44        button_select_all = new QPushButton(this); 
     45        button_select_all->setText(QString::fromUtf8("Выбрать все")); 
     46        layout_button->addWidget(button_select_all); 
     47 
     48        button_select_none = new QPushButton(this); 
     49        button_select_none->setText(QString::fromUtf8("Отменить все")); 
     50        layout_button->addWidget(button_select_none); 
     51 
     52        spacer_button = new QSpacerItem(1, height(), QSizePolicy::Maximum, QSizePolicy::Expanding); 
     53        layout_button->addItem(spacer_button); 
     54 
    4455        button_cancel = new QPushButton(this); 
    4556        button_cancel->setText(QString::fromUtf8("Отмена")); 
    4657        button_cancel->setShortcut(QKeySequence("Esc")); 
    4758        layout_button->addWidget(button_cancel); 
    48  
    49         spacer_button = new QSpacerItem(1, height(), QSizePolicy::Maximum, QSizePolicy::Expanding); 
    50         layout_button->addItem(spacer_button); 
    5159} 
    5260//---------------------------------------------------------------------------------------------- 
  • trunk/form_subscribe_ui.h

    r18 r35  
    2727                QPushButton* button_ok; 
    2828                QPushButton* button_refresh; 
     29                QPushButton* button_select_all; 
     30                QPushButton* button_select_none; 
    2931                QPushButton* button_cancel; 
    3032 
Note: See TracChangeset for help on using the changeset viewer.