Esempio n. 1
0
PackageItem::PackageItem(Package* p, int index, QWidget* parent): QWidget(parent),
  package(0), title(), size(),
  installButton("Install"), removeButton("Remove"), upgradeButton("Upgrade"), detailsButton("Details"), progressBar()
{
  connect(&installButton, SIGNAL(clicked(bool)), this, SLOT(handleInstall()));
  connect(&removeButton, SIGNAL(clicked(bool)), this, SLOT(handleRemove()));
  connect(&upgradeButton, SIGNAL(clicked(bool)), this, SLOT(handleUpgrade()));
  connect(&detailsButton, SIGNAL(clicked(bool)), this, SLOT(handleDetails()));
  
  if(index % 2)
  {
    QPalette newPalette(palette());
    newPalette.setColor(QPalette::AlternateBase, QColor(0, 0, 0, 32));
    setBackgroundRole(QPalette::AlternateBase);
    setPalette(newPalette);
  }
  
  setAutoFillBackground(true);
  
  QHBoxLayout* layout = new QHBoxLayout;
  setLayout(layout);
  layout->addWidget(&progressBar);
  progressBar.setMaximumWidth(64);
  layout->addWidget(&title);
  title.setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred);
  layout->addWidget(&size);
  layout->addWidget(&upgradeButton);
  upgradeButton.setStyleSheet("background-color: #6992D7; width: 48px;");
  layout->addWidget(&installButton);
  installButton.setStyleSheet("background-color: #69D772; width: 48px;");
  layout->addWidget(&removeButton);
  removeButton.setStyleSheet("background-color: #D76D69; width: 48px;");
  layout->addWidget(&detailsButton);
  setPackage(p);
}
Esempio n. 2
0
void QMofFactory::setPackage(QMofPackage *package)
{
    // This is a read-write property

    if (_package != package) {
        _package = package;
        if (package && package->asQModelingObject() && this->asQModelingObject())
            QObject::connect(package->asQModelingObject(), SIGNAL(destroyed()), this->asQModelingObject(), SLOT(setPackage()));
    }
}
Esempio n. 3
0
/*!
    Adjusts package to \a package.
 */
void QUmlType::setPackage(QUmlPackage *package)
{
    // This is a read-write association end

    if (_package != package) {
        _package = package;
        if (package && package->asQModelingObject() && this->asQModelingObject())
            QObject::connect(package->asQModelingObject(), SIGNAL(destroyed()), this->asQModelingObject(), SLOT(setPackage()));
    }
}