Beispiel #1
0
 int main(int argc, char *argv[])
 {
     QApplication app(argc, argv);
     QWidget window;
     QLabel *label = new QLabel(QApplication::translate("windowlayout", "Scale:"),&window);
	 QCheckBox *chb = new QCheckBox(QApplication::translate("windowlayout", "Calc mode"),&window);
	 mle *myline = new mle(&window);
	 render widget(&window);
     QPainter painter;
	 QSlider *spinbox = new QSlider(Qt::Horizontal,&window);
	 spinbox->setValue(30);
	 widget.setGeometry(10,10, 512, 512);
	 myline->setGeometry(10,532,512,20);
	 myline->setText("Enter expession");
	 myline->createStandardContextMenu();
	 myline->selectAll();
	 label->setGeometry(532,10,200,20);
	 chb->move(532,535);
	 spinbox->setGeometry(567,10,165,20);
	 spinbox->setRange(1, 200);
	 //Святое место определения механизма сигналов и слотов, унёсший 8 дней практики на реализацию передачи значений между экземплярами класса
	 //изменять с осторожностью и благословлением, церковная зона
	 QObject::connect(spinbox, SIGNAL(valueChanged(int)), &widget, SLOT(scale(int)));
	 QObject::connect(spinbox, SIGNAL(valueChanged(int)), myline, SLOT(emitsig()));
	 QObject::connect(myline, SIGNAL(returnPressed()), myline, SLOT(emitsig()));
	 QObject::connect(myline, SIGNAL(givechar(QString)), &widget, SLOT(calc(QString)));
	 QObject::connect(chb, SIGNAL(stateChanged(int)), &widget, SLOT(chk(int)));
	 QObject::connect(&widget, SIGNAL(emitstr(QString)), myline, SLOT(takestr(QString)));
	 //конец защищенной церковной зоны
     window.setWindowTitle(
         QApplication::translate("GCPLOT", "GCPLOT"));
	 window.setFixedSize(742, 562);
	 window.show();
     return app.exec();
 }
void MusicSoundKMicroSettingPopWidget::initWidget()
{
    setFixedSize(54, 24);
    setTranslucentBackground();

    m_recordCore = nullptr;
    m_containWidget->setFixedSize(310, 190);
    m_containWidget->setStyleSheet(MusicUIObject::MBackgroundStyle08 + MusicUIObject::MColorStyle03);

    QCheckBox *checkBox = new QCheckBox(tr("Hear Yourself Singing"), m_containWidget);
    checkBox->setGeometry(10, 20, 280, 25);
    checkBox->setStyleSheet(MusicUIObject::MCheckBoxStyle05);

    QCheckBox *checkBox2 = new QCheckBox(tr("Noise Elimination"), m_containWidget);
    checkBox2->setGeometry(10, 50, 280, 25);
    checkBox2->setStyleSheet(MusicUIObject::MCheckBoxStyle05);

#ifdef Q_OS_UNIX
    checkBox->setFocusPolicy(Qt::NoFocus);
    checkBox2->setFocusPolicy(Qt::NoFocus);
#endif

    QLabel *microIconLabel = new QLabel(m_containWidget);
    microIconLabel->setGeometry(10, 92, 26, 18);

    QSlider *slider = new QSlider(Qt::Horizontal, m_containWidget);
    slider->setGeometry(36, 90, 150, 25);
    slider->setStyleSheet(QString("QSlider{%1}").arg(MusicUIObject::MBackgroundStyle01) + MusicUIObject::MSliderStyle01);
    slider->setRange(0, 100);
    slider->setValue(100);
    connect(slider, SIGNAL(valueChanged(int)), SLOT(volumeChanged(int)));

    QLabel *inputLabel = new QLabel(tr("Input"), m_containWidget);
    inputLabel->setGeometry(10, 120, 50, 25);
    inputLabel->setStyleSheet(MusicUIObject::MBackgroundStyle01);
    m_inputComboBox = new QComboBox(m_containWidget);
    m_inputComboBox->setGeometry(60, 120, 230, 25);
    m_inputComboBox->setStyleSheet(MusicUIObject::MBorderStyle04);
    m_inputComboBox->setItemDelegate(new QStyledItemDelegate(m_inputComboBox));
    m_inputComboBox->view()->setStyleSheet(MusicUIObject::MScrollBarStyle01);
    foreach(const QAudioDeviceInfo &info, QAudioDeviceInfo::availableDevices(QAudio::AudioInput))
    {
        m_inputComboBox->addItem(info.deviceName());
    }
Beispiel #3
0
void KMix::placeWidgets()
{
  int sliderHeight=100;
  int qsMaxY=0;
  int ix = 0;
  int iy = 0;

  QSlider *qs;
  QLabel  *qb;

  // Place Sliders (Volume indicators)
  ix  = 0;
  if (mainmenuOn)
    mainmenu->show();
  else
    mainmenu->hide();


  bool first = true;
  MixDevice *MixPtr = mix->First;
  while (MixPtr) {
    if (MixPtr->is_disabled) {
      MixPtr->picLabel->hide();
      MixPtr->Left->slider->hide();
      if (MixPtr->is_stereo)
	MixPtr->Right->slider->hide();
      MixPtr=MixPtr->Next;
      continue;
    }

    if ( !first ) ix += 6;
    else          ix += 4; // On first loop add 4

    int old_x=ix;

    qb = MixPtr->picLabel;

    // left slider
    qs = MixPtr->Left->slider;
    if (tickmarksOn) {
      qs->setTickmarks(QSlider::Left);
      qs->setTickInterval(10);
    }
    else
      qs->setTickmarks(QSlider::NoMarks);

    QSize VolSBsize = qs->sizeHint();
    qs->setValue(100-MixPtr->Left->volume);
    qs->setGeometry( ix, iy+qb->height(), VolSBsize.width(), sliderHeight);

    qs->move(ix,iy+qb->height());
    qs->show();

    // Its a good point to find out the maximum y pos of the slider right here
    if (first)
      qsMaxY = qs->y()+qs->height();

    ix += qs->width();

    // But make sure it isn't linked to the left channel.
    bool BothSliders =
      (MixPtr->is_stereo  == true ) &&
      (MixPtr->StereoLink == false);

    QString ToolTipString;
    ToolTipString = MixPtr->name();
    if ( BothSliders)
      ToolTipString += " (Left)";
    QToolTip::add( qs, ToolTipString );

    // Mark record source(s) and muted channel(s). This is done by ordinary
    // color marks on the slider, but this will be changed by red and green
    // and black "bullets" below the slider. TODO !!!
    if (MixPtr->is_recsrc)
      qs->setBackgroundColor( red );
    else {
      if (MixPtr->is_muted)
	qs->setBackgroundColor( black );
      else
	qs->setBackgroundColor( colorGroup().mid() );
    }

    if (MixPtr->is_stereo  == true) {
      qs = MixPtr->Right->slider;
	
      if (MixPtr->StereoLink == false) {
	// Show right slider
	if (tickmarksOn) {
	  qs->setTickmarks(QSlider::Right);
	  qs->setTickInterval(10);
	}
	else
	  qs->setTickmarks(QSlider::NoMarks);
	
	QSize VolSBsize = qs->sizeHint();
	qs->setValue(100-MixPtr->Right->volume);
	qs->setGeometry( ix, iy+qb->height(), VolSBsize.width(), sliderHeight);

	ix += qs->width();
	ToolTipString = MixPtr->name();
	ToolTipString += " (Right)";
	QToolTip::add( qs, ToolTipString );

	if (MixPtr->is_recsrc)
	  qs->setBackgroundColor( red );
	else {
	  if (MixPtr->is_muted)
	    qs->setBackgroundColor( black );
	  else
	    qs->setBackgroundColor( colorGroup().mid() );
	}

	qs->show();
      }
      else
	// Don't show right slider
	qs->hide();
    }

    // Pixmap label. Place it horizontally centered to volume slider(s)
    qb->move((int)((ix + old_x - qb->width() )/2),iy);
    qb->show();


    first=false;
    MixPtr=MixPtr->Next;
  }

  ix += 4;
  iy = qsMaxY;
  LeftRightSB->setGeometry(0,iy,ix,LeftRightSB->sizeHint().height());

  iy+=LeftRightSB->height();
  Container->setFixedSize( ix, iy );
  updateRects();
}