selectcolors.ui.h 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. /****************************************************************************
  2. ** ui.h extension file, included from the uic-generated form implementation.
  3. **
  4. ** If you want to add, delete, or rename functions or slots, use
  5. ** Qt Designer to update this file, preserving your code.
  6. **
  7. ** You should not define a constructor or destructor in this file.
  8. ** Instead, write your code in functions called init() and destroy().
  9. ** These will automatically be called by the form's constructor and
  10. ** destructor.
  11. *****************************************************************************/
  12. /*
  13. ktigcc - TIGCC IDE for KDE
  14. Copyright (C) 2006 Kevin Kofler
  15. This program is free software; you can redistribute it and/or modify
  16. it under the terms of the GNU General Public License as published by
  17. the Free Software Foundation; either version 2, or (at your option)
  18. any later version.
  19. This program is distributed in the hope that it will be useful,
  20. but WITHOUT ANY WARRANTY; without even the implied warranty of
  21. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  22. GNU General Public License for more details.
  23. You should have received a copy of the GNU General Public License
  24. along with this program; if not, write to the Free Software Foundation,
  25. Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  26. */
  27. #include <kcolordialog.h>
  28. #include <qcolor.h>
  29. #include "colorlistitem.h"
  30. void SelectColors::colorList_selectionChanged()
  31. {
  32. bool haveSelectedItem=!!colorList->selectedItem();
  33. removeButton->setEnabled(haveSelectedItem);
  34. editButton->setEnabled(haveSelectedItem);
  35. }
  36. void SelectColors::addButton_clicked()
  37. {
  38. QColor color;
  39. if (KColorDialog::getColor(color,this)==KColorDialog::Accepted)
  40. new ColorListItem(colorList,color);
  41. }
  42. void SelectColors::removeButton_clicked()
  43. {
  44. delete colorList->selectedItem();
  45. }
  46. void SelectColors::editButton_clicked()
  47. {
  48. ColorListItem *item=static_cast<ColorListItem *>(colorList->selectedItem());
  49. if (item) {
  50. QColor color=item->color();
  51. if (KColorDialog::getColor(color,this)==KColorDialog::Accepted)
  52. item->setColor(color);
  53. }
  54. }