private void updateUI() { lblLastFrameProcessed.setText(Integer.toString(framesProcessed.get())); lblFramesProcessedPerSecond.setText(framesProcessRate.getFormattedRate()); lblLastFrameSaved.setText(Integer.toString(framesSaved.get())); if (previewEnabled) { previewPicture.updatePicture(); } if (audioBufferInUse && parent.isAudioBufferInUse()) { switch (audioBufferStatus) { case REGULAR: audioBuffer.setMaximum(audioBufferTotal); audioBuffer.setValue(audioBufferOccupied); lblAudioBuffer1.setText( (audioBufferOccupied / 1024) + Strings.lblRenderAudioBuffer1 + (audioBufferOccupied * 100 / audioBufferTotal) + Strings.lblRenderAudioBuffer2); lblAudioBuffer2.setText( Strings.lblRenderAudioBuffer3 + (audioBufferTotal / 1024) + Strings.lblRenderAudioBuffer4); btnFlushAudioBuffer.setText(Strings.btnRenderAudioBufferFlush); enabledAudioWidgets(audioBufferOccupied > 0 && audioBufferTotal > 0); break; case FLUSHING: case DESTROYED: audioBuffer.setMaximum(1); audioBuffer.setValue(0); btnFlushAudioBuffer.setEnabled(false); break; } } else { enabledAudioWidgets(false); } }
public static void main(String args[]) { QApplication.initialize(args); // ! [0] QLabel label = new QLabel(); label.setFrameStyle(QFrame.Shadow.Sunken.value() | QFrame.Shape.Panel.value()); label.setText("first line\nsecond line"); label.setAlignment(Qt.AlignmentFlag.AlignBottom, Qt.AlignmentFlag.AlignRight); // ! [0] // ! [1] QLineEdit phoneEdit = new QLineEdit(); QLabel phoneLabel = new QLabel("Phone:"); phoneLabel.setBuddy(phoneEdit); // ! [1] // ! [2] QLineEdit nameEd = new QLineEdit(); QLabel nameLb = new QLabel("Name:"); nameLb.setBuddy(nameEd); QLineEdit phoneEd = new QLineEdit(); QLabel phoneLb = new QLabel("Phone:"); phoneLb.setBuddy(phoneEd); // (layout setup not shown) // ! [2] }
protected MyAbstractDockWidget(String title) { super(title); setFeatures(DockWidgetFeature.DockWidgetMovable); label = new QLabel("Move me!"); label.setContentsMargins(50, 50, 50, 50); label.setAlignment(AlignmentFlag.AlignCenter); setWidget(label); }
public QDockWidgetLocationChangedBug() { resize(640, 400); final QLabel label = new QLabel("Central widget"); label.setAlignment(AlignmentFlag.AlignCenter); label.setFrameShadow(Shadow.Plain); label.setFrameShape(Shape.Panel); setCentralWidget(label); addDockWidget(DockWidgetArea.LeftDockWidgetArea, new MyBadDockWidget()); addDockWidget(DockWidgetArea.RightDockWidgetArea, new MyGoodDockWidget()); show(); }
private QLabel createPixmapLabel() { QLabel label = new QLabel(); label.setEnabled(false); label.setAlignment(Qt.AlignmentFlag.AlignCenter); label.setFrameShape(QFrame.Shape.Box); label.setSizePolicy(QSizePolicy.Policy.Expanding, QSizePolicy.Policy.Expanding); label.setBackgroundRole(QPalette.ColorRole.Base); label.setAutoFillBackground(true); label.setMinimumSize(132, 132); return label; }
void setData(String mimetype, QByteArray newData) { mimeType = mimetype; data = new QByteArray(newData); dragDropLabel.setText(String.valueOf(data.size()) + " bytes."); List<String> formats = new Vector<String>(); formats.add(mimetype); mimeTypes.emit(formats); }
public dragwidget(QWidget parent) { super(parent); setFrameStyle(QFrame.Shape.StyledPanel.value() | QFrame.Shadow.Sunken.value()); dragDropLabel = new QLabel("", this); dragDropLabel.setAlignment(new Qt.Alignment(Qt.AlignmentFlag.AlignHCenter)); QHBoxLayout layout = new QHBoxLayout(this); layout.addStretch(0); layout.addWidget(dragDropLabel); layout.addStretch(0); setAcceptDrops(true); }
private void setErrorMessage(final String errorMessage) { lblStatus.setText(errorMessage); QPalette palette = lblStatus.palette(); palette.setBrush(ColorRole.WindowText, new QBrush(QColor.red)); lblStatus.setPalette(palette); }
private void initUI() { final QHBoxLayout mainHbox = new QHBoxLayout(); { final QGroupBox videoBox = new QGroupBox(Strings.grpRenderingVideoFrames); final QVBoxLayout videoVbox = new QVBoxLayout(); { final QHBoxLayout hbox = new QHBoxLayout(); hbox.addWidget(new QLabel(Strings.lblLastFrameProcessed)); lblLastFrameProcessed = new QLabel(Strings.lblLastFrameProcessedDefault); lblLastFrameProcessed.setAlignment(AlignmentFlag.AlignRight); hbox.addWidget(lblLastFrameProcessed); videoVbox.addLayout(hbox, 0); } { final QHBoxLayout hbox = new QHBoxLayout(); hbox.addWidget(new QLabel(Strings.lblFramesProcessedPerSecond)); lblFramesProcessedPerSecond = new QLabel(Strings.lblFramesProcessedPerSecondDefault); lblFramesProcessedPerSecond.setAlignment(AlignmentFlag.AlignRight); hbox.addWidget(lblFramesProcessedPerSecond); videoVbox.addLayout(hbox, 0); } { final QHBoxLayout hbox = new QHBoxLayout(); hbox.addWidget(new QLabel(Strings.lblLastFrameSaved)); lblLastFrameSaved = new QLabel(Strings.lblLastFrameSavedDefault); lblLastFrameSaved.setAlignment(AlignmentFlag.AlignRight); hbox.addWidget(lblLastFrameSaved); videoVbox.addLayout(hbox, 0); } { previewPicture = new UpdatablePicture( Files.iconRenderingDefault, maximumPreviewWidth, maximumPreviewHeight); videoVbox.addWidget(previewPicture, 1); } { previewEnabledCheckbox = new QCheckBox(Strings.lblEnablePreview); previewEnabledCheckbox.stateChanged.connect(this, "updatePreviewEnabled()"); previewEnabled = getSettings().getPreviewEnabled(); previewEnabledCheckbox.setChecked(previewEnabled); videoVbox.addWidget(previewEnabledCheckbox, 0, AlignmentFlag.AlignHCenter); } videoBox.setLayout(videoVbox); mainHbox.addWidget(videoBox, 1); } { final QGroupBox audioBox = new QGroupBox(Strings.grpRenderingAudioBuffer); final QVBoxLayout audioVbox = new QVBoxLayout(); { audioBuffer = new QProgressBar(); audioBuffer.setOrientation(Orientation.Vertical); audioBuffer.setSizePolicy(Policy.Expanding, Policy.Expanding); audioVbox.addWidget(audioWidget(audioBuffer), 1, AlignmentFlag.AlignHCenter); lblAudioBuffer1 = new QLabel(); audioVbox.addWidget(audioWidget(lblAudioBuffer1), 0, AlignmentFlag.AlignCenter); lblAudioBuffer2 = new QLabel(); audioVbox.addWidget(audioWidget(lblAudioBuffer2), 0, AlignmentFlag.AlignCenter); btnFlushAudioBuffer = new QPushButton(Strings.btnRenderAudioBufferFlush); btnFlushAudioBuffer.clicked.connect(this, "onFlushAudioBuffer()"); btnFlushAudioBuffer.setEnabled(false); audioVbox.addWidget(audioWidget(btnFlushAudioBuffer), 0, AlignmentFlag.AlignCenter); } audioBox.setLayout(audioVbox); mainHbox.addWidget(audioBox, 0); } setLayout(mainHbox); }
public void setupUi(QWidget Form) { expand = false; holder = new QWidget(Form); Form.layout().addWidget(holder); holder.setObjectName("holder"); holder.setGeometry(new QRect(0, 0, 621, 101)); QSizePolicy sizePolicy = new QSizePolicy( com.trolltech.qt.gui.QSizePolicy.Policy.Minimum, com.trolltech.qt.gui.QSizePolicy.Policy.Fixed); sizePolicy.setHorizontalStretch((byte) 0); sizePolicy.setVerticalStretch((byte) 0); sizePolicy.setHeightForWidth(holder.sizePolicy().hasHeightForWidth()); holder.setSizePolicy(sizePolicy); holder.setMinimumSize(new QSize(621, 101)); holder.setStyleSheet( "QWidget#holder{\n" + " background-color: rgba(52, 52, 52, 255);\n" + " border-style: solid;\n" + " border-color: rgba(255, 255, 255, 150);\n" + " border-width: 3px;\n" + "}\n" + "\n" + "QLabel{\n" + " font: 16pt \"Calibri\";\n" + " color: white;\n" + "}\n" + "\n" + "#fNameLabel, #lNameLabel, #tLatesLabel, #tAbsentLabel, #cStatusLabel, #timeLabel, #idLabel, #curclaslab, #curLoclabel, #entryLabel, #exitLabel{\n" + "font: 12pt \"Calibri\";\n" + " color: white;\n" + "}\n" + "QPushButton{\n" + " background-color: white;\n" + " border-radius: 10px;\n" + "}\n" + "\n" + "QPushButton:hover{\n" + " background-color: rgb(220, 220, 220); }\n" + "#holder:hover{\n" + " border-width: 4px; background-color:rgba(30, 30, 30, 255);\n" + "}\n" + "\n" + "#p1, #p2, #p3, #p4{\n" + " border-style: solid;\n" + " border-color: rgba(0,0,0,0);\n" + " border-width: 3px;\n" + " background-color: white;\n" + " color: black;\n" + "}\n" + "\n" + "#p1, #p2, #p3{\n" + " border-right-color: rgb(0, 0, 0);\n" + "\n" + "}"); fNameLabel = new QLabel(holder); fNameLabel.setObjectName("fNameLabel"); fNameLabel.setGeometry(new QRect(10, 0, 101, 31)); lNameLabel = new QLabel(holder); lNameLabel.setObjectName("lNameLabel"); lNameLabel.setGeometry(new QRect(10, 30, 81, 31)); tLatesLabel = new QLabel(holder); tLatesLabel.setObjectName("tLatesLabel"); tLatesLabel.setGeometry(new QRect(10, 130, 111, 31)); tAbsentLabel = new QLabel(holder); tAbsentLabel.setObjectName("tAbsentLabel"); tAbsentLabel.setGeometry(new QRect(270, 130, 111, 31)); cStatusLabel = new QLabel(holder); cStatusLabel.setObjectName("cStatusLabel"); cStatusLabel.setGeometry(new QRect(270, 0, 111, 31)); deleteButton = new QPushButton(holder); deleteButton.setObjectName("deleteButton"); deleteButton.setGeometry(new QRect(580, 10, 31, 31)); fname = new QLabel(holder); fname.setObjectName("fname"); fname.setGeometry(new QRect(120, 0, 131, 31)); lname = new QLabel(holder); lname.setObjectName("lname"); lname.setGeometry(new QRect(120, 30, 131, 31)); cStatus = new QLabel(holder); cStatus.setObjectName("cStatus"); cStatus.setGeometry(new QRect(390, 0, 101, 31)); lates = new QLabel(holder); lates.setObjectName("lates"); lates.setGeometry(new QRect(120, 130, 111, 31)); absents = new QLabel(holder); absents.setObjectName("absents"); absents.setGeometry(new QRect(390, 130, 111, 31)); absents.setStyleSheet(""); expandButton = new QPushButton(holder); expandButton.setObjectName("expandButton"); expandButton.setGeometry(new QRect(580, 60, 31, 31)); timeLabel = new QLabel(holder); timeLabel.setObjectName("timeLabel"); timeLabel.setGeometry(new QRect(10, 170, 111, 31)); idLabel = new QLabel(holder); idLabel.setObjectName("idLabel"); idLabel.setGeometry(new QRect(10, 60, 111, 31)); id = new QLabel(holder); id.setObjectName("id"); id.setGeometry(new QRect(120, 60, 131, 31)); curLoclabel = new QLabel(holder); curLoclabel.setObjectName("curLoclabel"); curLoclabel.setGeometry(new QRect(270, 100, 111, 31)); curLocation = new QLabel(holder); curLocation.setObjectName("curLocation"); curLocation.setGeometry(new QRect(390, 100, 121, 31)); curLocation.setStyleSheet(""); curclaslab = new QLabel(holder); curclaslab.setObjectName("curclaslab"); curclaslab.setGeometry(new QRect(10, 100, 111, 31)); currClass = new QLabel(holder); currClass.setObjectName("currClass"); currClass.setGeometry(new QRect(120, 100, 121, 31)); currClass.setStyleSheet(""); entryLabel = new QLabel(holder); entryLabel.setObjectName("entryLabel"); entryLabel.setGeometry(new QRect(270, 30, 121, 31)); exitLabel = new QLabel(holder); exitLabel.setObjectName("exitLabel"); exitLabel.setGeometry(new QRect(270, 60, 111, 31)); entryTime = new QLabel(holder); entryTime.setObjectName("entryTime"); entryTime.setGeometry(new QRect(390, 30, 71, 31)); exitTime = new QLabel(holder); exitTime.setObjectName("exitTime"); exitTime.setGeometry(new QRect(390, 60, 71, 31)); p1 = new QLabel(holder); p1.setObjectName("p1"); p1.setGeometry(new QRect(120, 170, 101, 31)); p2 = new QLabel(holder); p2.setObjectName("p2"); p2.setGeometry(new QRect(220, 170, 101, 31)); p3 = new QLabel(holder); p3.setObjectName("p3"); p3.setGeometry(new QRect(320, 170, 101, 31)); p4 = new QLabel(holder); p4.setObjectName("p4"); p4.setGeometry(new QRect(420, 170, 101, 31)); /* label = new QLabel(holder); label.setObjectName("label"); label.setGeometry(new QRect(480, 10, 81, 71)); label.setPixmap(new QPixmap(("classpath:admin_resource/logout.png"))); label.setScaledContents(true); */ this.expandButton.raise(); this.deleteButton.raise(); retranslateUi(Form); } // setupUi
public void retranslateUi(QWidget Form) { this.expandButton.connectSlotsByName(); this.deleteButton.connectSlotsByName(); this.expandButton.clicked.connect(this, "big()"); this.deleteButton.clicked.connect(this, "delete()"); expand = false; this.expandButton.raise(); this.deleteButton.raise(); holder.lower(); fNameLabel.setText( com.trolltech.qt.core.QCoreApplication.translate("Form", "First name:", null)); lNameLabel.setText( com.trolltech.qt.core.QCoreApplication.translate("Form", "Last name:", null)); tLatesLabel.setText( com.trolltech.qt.core.QCoreApplication.translate("Form", "Total Lates:", null)); tAbsentLabel.setText( com.trolltech.qt.core.QCoreApplication.translate("Form", "Total Absents:", null)); cStatusLabel.setText( com.trolltech.qt.core.QCoreApplication.translate("Form", "Current Status:", null)); deleteButton.setText(com.trolltech.qt.core.QCoreApplication.translate("Form", " X", null)); fname.setText(com.trolltech.qt.core.QCoreApplication.translate("Form", "TextLabel", null)); lname.setText(com.trolltech.qt.core.QCoreApplication.translate("Form", "TextLabel", null)); cStatus.setText(com.trolltech.qt.core.QCoreApplication.translate("Form", "TextLabel", null)); lates.setText(com.trolltech.qt.core.QCoreApplication.translate("Form", "TextLabel", null)); absents.setText(com.trolltech.qt.core.QCoreApplication.translate("Form", "TextLabel", null)); expandButton.setText(com.trolltech.qt.core.QCoreApplication.translate("Form", "\\/", null)); timeLabel.setText(com.trolltech.qt.core.QCoreApplication.translate("Form", "Timetable:", null)); idLabel.setText(com.trolltech.qt.core.QCoreApplication.translate("Form", "Student ID:", null)); id.setText(com.trolltech.qt.core.QCoreApplication.translate("Form", "TextLabel", null)); curLoclabel.setText( com.trolltech.qt.core.QCoreApplication.translate("Form", "Current location:", null)); curLocation.setText( com.trolltech.qt.core.QCoreApplication.translate("Form", "TextLabel", null)); curclaslab.setText( com.trolltech.qt.core.QCoreApplication.translate("Form", "Current class:", null)); currClass.setText(com.trolltech.qt.core.QCoreApplication.translate("Form", "TextLabel", null)); entryLabel.setText( com.trolltech.qt.core.QCoreApplication.translate("Form", "Entry Time:", null)); exitLabel.setText(com.trolltech.qt.core.QCoreApplication.translate("Form", "Exit Time:", null)); entryTime.setText(com.trolltech.qt.core.QCoreApplication.translate("Form", "Text Label", null)); exitTime.setText(com.trolltech.qt.core.QCoreApplication.translate("Form", "Text Label", null)); p1.setText(com.trolltech.qt.core.QCoreApplication.translate("Form", "TextLabel", null)); p2.setText(com.trolltech.qt.core.QCoreApplication.translate("Form", "TextLabel", null)); p3.setText(com.trolltech.qt.core.QCoreApplication.translate("Form", "TextLabel", null)); p4.setText(com.trolltech.qt.core.QCoreApplication.translate("Form", "TextLabel", null)); } // retranslateUi
private QLabel createHeaderLabel(String text) { QLabel label = new QLabel(tr("<b>" + text + "</b>")); label.setAlignment(Qt.AlignmentFlag.AlignCenter); return label; }