当前位置: 首页>>代码示例>>Python>>正文


Python QVBoxLayout.setAlignment方法代码示例

本文整理汇总了Python中PyQt5.QtWidgets.QVBoxLayout.setAlignment方法的典型用法代码示例。如果您正苦于以下问题:Python QVBoxLayout.setAlignment方法的具体用法?Python QVBoxLayout.setAlignment怎么用?Python QVBoxLayout.setAlignment使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PyQt5.QtWidgets.QVBoxLayout的用法示例。


在下文中一共展示了QVBoxLayout.setAlignment方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: inut_ui

# 需要导入模块: from PyQt5.QtWidgets import QVBoxLayout [as 别名]
# 或者: from PyQt5.QtWidgets.QVBoxLayout import setAlignment [as 别名]
    def inut_ui(self, name, args):
        vl = QVBoxLayout()
        lbl = QLabel(self)
        lbl.setAlignment(QtCore.Qt.AlignCenter)
        lbl.setText(name)
        vl.addWidget(lbl)
        hl = QHBoxLayout()
        il = QVBoxLayout()
        il.setAlignment(QtCore.Qt.AlignTop)
        for arg in args:
            if arg['io'] == 'i':
                inp_lbl = QLabel(self)
                self._inputs[arg['name']] = inp_lbl
                inp_lbl.setText(arg['name'])

                il.addWidget(inp_lbl)
        ol = QVBoxLayout()
        ol.setAlignment(QtCore.Qt.AlignTop)
        for arg in args:
            if arg['io'] == 'o':
                out_lbl = QLabel(self)
                self._outputs[arg['name']] = out_lbl
                out_lbl.setAlignment(QtCore.Qt.AlignRight)
                out_lbl.setText(arg['name'])
                ol.addWidget(out_lbl)
        hl.addLayout(il)
        hl.addLayout(ol)
        vl.addLayout(hl)
        self.setLayout(vl)
开发者ID:ctlab,项目名称:BioinformaticsDSL,代码行数:31,代码来源:step.py

示例2: __init__

# 需要导入模块: from PyQt5.QtWidgets import QVBoxLayout [as 别名]
# 或者: from PyQt5.QtWidgets.QVBoxLayout import setAlignment [as 别名]
    def __init__(self, user_display_name, user_profile, *args, **kwargs):
        super().__init__(*args, **kwargs)

        assert isinstance(user_profile, UserProfile)

        # Initialize the user management.
        self._user_display_name = user_display_name
        db_user = user_profile["database_user_name"]
        db_location = user_profile["database_location"]
        self._user_management = UserManagement(db_user, db_location)

        # Create the task box.
        self._task_list = TaskList()
        self._task_list.load_open_tasks(self._user_management)
        self._task_list.delete.connect(self._on_delete_task)
        self._task_list.start.connect(self._on_start_task)
        self._task_list.stop.connect(self._on_stop_task)
        self._task_list.done.connect(self._on_task_done)

        # Create the tracking controls.
        self._tracking_controls = TrackingControls()
        self._tracking_controls.create_task.connect(self._on_create_task)
        self._tracking_controls.general_work.connect(self._on_general_work)
        self._tracking_controls.pause.connect(self._on_pause)
        self._tracking_controls.end_of_work.connect(self._on_end_of_work)

        # Create the layout.
        layout = QVBoxLayout()
        layout.setAlignment(Qt.AlignCenter)
        self.setLayout(layout)
        layout.addWidget(self._tracking_controls)
        layout.addWidget(self._task_list)
开发者ID:dagophil,项目名称:mesme,代码行数:34,代码来源:track_screen.py

示例3: SImageView

# 需要导入模块: from PyQt5.QtWidgets import QVBoxLayout [as 别名]
# 或者: from PyQt5.QtWidgets.QVBoxLayout import setAlignment [as 别名]
class SImageView(QMainWindow):
	"""docstring for SImageBrower"""
	def __init__(self, imageBrower, title = None):
		super(SImageView, self).__init__()
		self.setWindowTitle(title if title != None else "形象编辑器")
		self.setWindowIcon(QIcon("./resource/test.ico"))
		self.mainWidget = QWidget()
		self.mainContainer = QVBoxLayout()
		self.mainContainer.setAlignment(Qt.AlignLeft)
		self.setCentralWidget(self.mainWidget)
		self.mainWidget.setLayout(self.mainContainer)
		self.imageBrower = imageBrower
		self.mainContainer.addWidget(imageBrower)
		self.createToolBar()

	def createToolBar(self):
		self.toolBar = self.addToolBar("形象编辑")
		self.openAct = QAction(QIcon('./resource/open.png'), "&Open...",
                self, shortcut=QKeySequence.Open,
                statusTip="Open an image folder", triggered=self.open)
		self.toolBar.addAction(self.openAct)

	def open(self):
		imageDir = QFileDialog.getExistingDirectory(self)
		self.imageBrower.resetImageDir(imageDir)
开发者ID:3qwasd,项目名称:jobs,代码行数:27,代码来源:SImageView.py

示例4: __init__

# 需要导入模块: from PyQt5.QtWidgets import QVBoxLayout [as 别名]
# 或者: from PyQt5.QtWidgets.QVBoxLayout import setAlignment [as 别名]
    def __init__(self, parent=None):
        """Initiate the abstract widget that is displayed in the preferences dialog."""
        super(Playback, self).__init__(parent)
        self.user_config_file = os.path.join(AppDirs('mosaic', 'Mandeep').user_config_dir,
                                             'settings.toml')

        with open(self.user_config_file) as conffile:
            config = toml.load(conffile)

        playback_config = QGroupBox('Playback Configuration')
        playback_config_layout = QVBoxLayout()
        playback_config_layout.setAlignment(Qt.AlignTop)

        self.cover_art_playback = QCheckBox('Cover Art Playback')
        self.playlist_save_checkbox = QCheckBox('Save Playlist on Close')

        playback_config_layout.addWidget(self.cover_art_playback)
        playback_config_layout.addWidget(self.playlist_save_checkbox)

        playback_config.setLayout(playback_config_layout)

        main_layout = QVBoxLayout()
        main_layout.addWidget(playback_config)

        self.setLayout(main_layout)

        self.check_playback_setting(config)
        self.check_playlist_save(config)
        self.cover_art_playback.clicked.connect(lambda: self.cover_art_playback_setting(config))
        self.playlist_save_checkbox.clicked.connect(lambda: self.playlist_save_setting(config))
开发者ID:mandeepbhutani,项目名称:Mosaic,代码行数:32,代码来源:configuration.py

示例5: init_ui

# 需要导入模块: from PyQt5.QtWidgets import QVBoxLayout [as 别名]
# 或者: from PyQt5.QtWidgets.QVBoxLayout import setAlignment [as 别名]
    def init_ui(self):
        """Initialize all GUI elements and show window."""

        self.set_status('Welcome')
        self.create_menus()

        canvas_box = self.create_canvas()
        sequence_form = self.create_sequence_form()

        # let's have the sequence form over the canvas.
        vbox = QVBoxLayout()
        vbox.addLayout(sequence_form, stretch=0)
        vbox.setAlignment(Qt.AlignTop)

        vbox.addLayout(canvas_box, stretch=1)

        splitter = QSplitter(Qt.Horizontal)

        options = OptionPanel(self.args)

        for layout in [vbox, options]:
            widget = QWidget()
            widget.setLayout(layout)
            splitter.addWidget(widget)

        self.setCentralWidget(splitter)

        self.resize(600, 600)
        self.setWindowTitle('Dotplot')
        self.show()
开发者ID:kn-bibs,项目名称:dotplot,代码行数:32,代码来源:main_window.py

示例6: AboutDialog

# 需要导入模块: from PyQt5.QtWidgets import QVBoxLayout [as 别名]
# 或者: from PyQt5.QtWidgets.QVBoxLayout import setAlignment [as 别名]
class AboutDialog(QDialog):
    """Contains the necessary elements to show the about dialog."""

    def __init__(self, parent=None):
        """Display a dialog that shows application information."""
        super(AboutDialog, self).__init__(parent)
        self.setWindowTitle('About')

        help_icon = utilities.resource_filename('mosaic.images', 'md_help.png')
        self.setWindowIcon(QIcon(help_icon))
        self.resize(300, 200)

        author = QLabel('Created by Mandeep')
        author.setAlignment(Qt.AlignCenter)

        icons = QLabel('Material design icons created by Google')
        icons.setAlignment(Qt.AlignCenter)

        github = QLabel('GitHub: mandeep')
        github.setAlignment(Qt.AlignCenter)

        self.layout = QVBoxLayout()
        self.layout.setAlignment(Qt.AlignVCenter)

        self.layout.addWidget(author)
        self.layout.addWidget(icons)
        self.layout.addWidget(github)

        self.setLayout(self.layout)
开发者ID:mandeepbhutani,项目名称:Mosaic,代码行数:31,代码来源:about.py

示例7: PlotTab

# 需要导入模块: from PyQt5.QtWidgets import QVBoxLayout [as 别名]
# 或者: from PyQt5.QtWidgets.QVBoxLayout import setAlignment [as 别名]
class PlotTab(QScrollArea):
    ''' InfoWindow tab for plots. '''
    def __init__(self):
        super(PlotTab, self).__init__()
        self.layout = QVBoxLayout()
        container = QWidget()
        container.setLayout(self.layout)
        self.layout.setAlignment(Qt.AlignTop)
        self.setWidget(container)
        self.setWidgetResizable(True)
        self.plots = dict()

    def update_plots(self, data, sender):
        ''' Update plots in this tab using incoming data. '''
        for fig, figdata in data.items():
            # First extract plot data when present
            x, y = figdata.pop('x', None), figdata.pop('y', None)

            plot = self.plots.get((sender, fig))
            if not plot:
                # If plot doesn't exist yet, create it
                plot = Plot(self, **figdata)
                self.plots[(sender, fig)] = plot
                self.layout.addWidget(plot)
            elif figdata:
                # When passed, apply updated figure settings
                plot.set(**figdata)

            if x is not None and y is not None:
                plot.update_data(x, y)
开发者ID:ProfHoekstra,项目名称:bluesky,代码行数:32,代码来源:infowindow.py

示例8: __init__

# 需要导入模块: from PyQt5.QtWidgets import QVBoxLayout [as 别名]
# 或者: from PyQt5.QtWidgets.QVBoxLayout import setAlignment [as 别名]
 def __init__(self):
     super().__init__()
     self.setTitle(_('Scores for correct and incorrect answers'))
     self.setSubTitle(_('Enter the scores of correct and incorrect '
                        'answers. The program will compute scores based '
                        'on them. Setting these scores is optional.'))
     form_widget = QWidget(parent=self)
     table_widget = QWidget(parent=self)
     main_layout = QVBoxLayout(self)
     form_layout = QFormLayout(form_widget)
     table_layout = QVBoxLayout(table_widget)
     self.setLayout(main_layout)
     form_widget.setLayout(form_layout)
     table_widget.setLayout(table_layout)
     main_layout.addWidget(form_widget)
     main_layout.addWidget(table_widget)
     main_layout.setAlignment(table_widget, Qt.AlignHCenter)
     self.combo = widgets.CustomComboBox(parent=self)
     self.combo.set_items([
         _('No scores'),
         _('Same score for all the questions'),
         _('Base score plus per-question weight'),
     ])
     self.combo.currentIndexChanged.connect(self._update_combo)
     self.correct_score = widgets.InputScore(is_positive=True)
     correct_score_label = QLabel(_('Score for correct answers'))
     incorrect_score_label = QLabel(_('Score for incorrect answers'))
     blank_score_label = QLabel(_('Score for blank answers'))
     self.incorrect_score = widgets.InputScore(is_positive=False)
     self.blank_score = widgets.InputScore(is_positive=False)
     self.button_reset = QPushButton(_('Reset question weights'))
     button_defaults = QPushButton(_('Compute default scores'))
     self.weights_table = widgets.CustomTableView()
     weights_table_label = QLabel(_('Per-question score weights:'))
     form_layout.addRow(self.combo)
     form_layout.addRow(correct_score_label, self.correct_score)
     form_layout.addRow(incorrect_score_label, self.incorrect_score)
     form_layout.addRow(blank_score_label, self.blank_score)
     table_layout.addWidget(weights_table_label)
     table_layout.addWidget(self.weights_table)
     table_layout.addWidget(self.button_reset)
     table_layout.addWidget(button_defaults)
     table_layout.setAlignment(weights_table_label, Qt.AlignHCenter)
     table_layout.setAlignment(self.weights_table, Qt.AlignHCenter)
     table_layout.setAlignment(self.button_reset, Qt.AlignHCenter)
     table_layout.setAlignment(button_defaults, Qt.AlignHCenter)
     self.button_reset.clicked.connect(self._reset_weights)
     button_defaults.clicked.connect(self._compute_default_values)
     self.base_score_widgets = [
         self.correct_score, correct_score_label,
         self.incorrect_score, incorrect_score_label,
         self.blank_score, blank_score_label,
         button_defaults,
     ]
     self.weights_widgets = [
         self.weights_table, weights_table_label,
     ]
     self.current_mode = None
开发者ID:jfisteus,项目名称:eyegrade,代码行数:60,代码来源:wizards.py

示例9: AnimationPanel

# 需要导入模块: from PyQt5.QtWidgets import QVBoxLayout [as 别名]
# 或者: from PyQt5.QtWidgets.QVBoxLayout import setAlignment [as 别名]
class AnimationPanel(QWidget):
	"""docstring for AnimationPanel"""
	rows = []
	views = []
	currRow = 0
	currCol = 0
	maxRow = 4
	maxCol = 4
	isSetBackground = False
	def __init__(self):
		super(AnimationPanel, self).__init__()
		self.setFixedSize(480,600)
		self.container = QVBoxLayout()
		self.setLayout(self.container)
		self.container.setSpacing(32)
		self.container.setAlignment(Qt.AlignTop)
		for i in range(0,self.maxRow):
			self.addRow()

	def addRow(self):
		row = QHBoxLayout()
		row.setSpacing(64)
		row.setAlignment(Qt.AlignLeft)
		self.rows.append(row)
		self.container.addLayout(row)

	def setBackGround(self,backColor):
		if self.isSetBackground : return
		palette = QPalette()
		palette.setColor(QPalette.Background,backColor)
		self.setAutoFillBackground(True)
		self.setPalette(palette);
		self.isSetBackground = True

	def closeAll(self):
		for i in range(0,self.maxRow):
			row = self.rows[i]
			for j in range(i*self.maxCol,min(i*self.maxCol+4,len(self.views))):
				row.removeWidget(self.views[j])
				self.views[j].close()
		self.views = []
		self.isSetBackground = False
		self.currRow = 0
		self.currCol = 0
			

	def addAnimationView(self,animationView):
		self.views.append(animationView)
		if self.currRow == self.maxRow:
			self.addRow()
			self.maxRow += 1
		self.rows[self.currRow].addWidget(animationView)
		animationView.createAnimation()
		self.currRow = self.currRow+1 if self.currCol == self.maxCol-1 else self.currRow
		self.currCol = 0 if self.currCol == self.maxCol-1 else self.currCol+1
		
开发者ID:3qwasd,项目名称:jobs,代码行数:57,代码来源:SImageBrower.py

示例10: __init__

# 需要导入模块: from PyQt5.QtWidgets import QVBoxLayout [as 别名]
# 或者: from PyQt5.QtWidgets.QVBoxLayout import setAlignment [as 别名]
    def __init__(self, parent=None):
        super(Example, self).__init__(parent)
        QApplication.setStyle(QStyleFactory.create('Fusion'))

        # -------------- QCOMBOBOX ----------------------
        cbx = QComboBox()
        # agregar lista de nombres de estilos disponibles
        cbx.addItems(QStyleFactory.keys())
        # responder al evento cambio de texto
        cbx.currentTextChanged.connect(self.textChanged)
        # seleccionar el ultimo elemento
        cbx.setItemText(4, 'Fusion')

        # -------------- QLISTWIDGET ---------------------
        items = ['Ubuntu', 'Linux', 'Mac OS', 'Windows', 'Fedora', 'Chrome OS', 'Android', 'Windows Phone']

        self.lv = QListWidget()
        self.lv.addItems(items)
        self.lv.itemSelectionChanged.connect(self.itemChanged)

        # -------------- QTABLEWIDGET --------------------
        self.table = QTableWidget(10, 3)
        # establecer nombre de cabecera de las columnas
        self.table.setHorizontalHeaderLabels(['Nombre', 'Edad', 'Nacionalidad'])
        # evento producido cuando cambia el elemento seleccionado
        self.table.itemSelectionChanged.connect(self.tableItemChanged)
        # alternar color de fila
        self.table.setAlternatingRowColors(True)
        # seleccionar solo filas
        self.table.setSelectionBehavior(QTableWidget.SelectRows)
        # usar seleccion simple, una fila a la vez
        self.table.setSelectionMode(QTableWidget.SingleSelection)

        table_data = [
            ("Alice", 15, "Panama"),
            ("Dana", 25, "Chile"),
            ("Fernada", 18, "Ecuador")
        ]

        # agregar cada uno de los elementos al QTableWidget
        for i, (name, age, city) in enumerate(table_data):
            self.table.setItem(i, 0, QTableWidgetItem(name))
            self.table.setItem(i, 1, QTableWidgetItem(str(age)))
            self.table.setItem(i, 2, QTableWidgetItem(city))

        vbx = QVBoxLayout()
        vbx.addWidget(QPushButton('Tutoriales PyQT-5'))
        vbx.setAlignment(Qt.AlignTop)
        vbx.addWidget(cbx)
        vbx.addWidget(self.lv)
        vbx.addWidget(self.table)

        self.setWindowTitle("Items View")
        self.resize(362, 320)
        self.setLayout(vbx)
开发者ID:TutorProgramacion,项目名称:pyqt-tutorial,代码行数:57,代码来源:item-view.py

示例11: display_content

# 需要导入模块: from PyQt5.QtWidgets import QVBoxLayout [as 别名]
# 或者: from PyQt5.QtWidgets.QVBoxLayout import setAlignment [as 别名]
    def display_content(self):
        #
        layout_main = QVBoxLayout()
        layout_main.setAlignment(Qt.AlignCenter)
        self.setLayout(layout_main)
        self.layouts.append(layout_main)

        #
        fonts = QFontDatabase()
        fonts.addApplicationFont('Fonts/Raleway/Raleway-ExtraLight.ttf')
        fonts.addApplicationFont('Fonts/OpenSans/OpenSans-Light.ttf')

        #
        title = QLabel("Eight Puzzle")
        title.setStyleSheet('font-size: 52px; color: #CECFD4;')
        title.setFont(QFont('Raleway'))
        layout_main.addWidget(title)
        layout_main.addSpacerItem(QSpacerItem(0, 12))

        #
        layout_tiles = QGridLayout()
        layout_tiles.setAlignment(Qt.AlignCenter)
        layout_main.addLayout(layout_tiles)
        for index in range(9):
            tile = QPushButton(str(self.puzzle.state[index]))
            tile.setStyleSheet('background-color: #879AA4;'
                               'color: #CECFD4; font-size: 32px;')
            tile.setFont(QFont('Open Sans'))
            tile.setFixedSize(75, 75)
            tile.setEnabled(False)
            tile.setFocusPolicy(Qt.NoFocus)
            layout_tiles.addWidget(tile, index / 3, index % 3)
            if self.puzzle.state[index] is '0':
                tile.setVisible(False)
            self.tiles.append(tile)
        self.layouts.append(layout_tiles)
        layout_main.addSpacerItem(QSpacerItem(0, 25))

        #
        layout_buttons = QGridLayout()
        layout_buttons.setAlignment(Qt.AlignCenter)
        layout_main.addLayout(layout_buttons)
        for index in range(3):
            button = QPushButton(['Shuffle', 'Solve', 'Quit'][index])
            button.setStyleSheet('background-color: #CECFD4;'
                                 'color: #363B57; font-size: 18px;')
            button.setFont(QFont('Raleway'))
            button.setFixedSize(90, 40)
            button.setFocusPolicy(Qt.NoFocus)
            layout_buttons.addWidget(button, 0, index)
            self.buttons.append(button)
        self.layouts.append(layout_buttons)
        layout_main.addSpacerItem(QSpacerItem(0, 10))
开发者ID:nsteely,项目名称:Eight-Puzzle,代码行数:55,代码来源:eight_puzzle_qt.py

示例12: PlotTab

# 需要导入模块: from PyQt5.QtWidgets import QVBoxLayout [as 别名]
# 或者: from PyQt5.QtWidgets.QVBoxLayout import setAlignment [as 别名]
class PlotTab(QScrollArea):
    def __init__(self):
        super(PlotTab, self).__init__()
        self.layout = QVBoxLayout()
        container = QWidget()
        container.setLayout(self.layout)
        self.layout.setAlignment(Qt.AlignTop)
        self.setWidget(container)
        self.setWidgetResizable(True)

    def addPlot(self):
        self.layout.addWidget(Plot(self))
开发者ID:isabelmetz,项目名称:bluesky,代码行数:14,代码来源:infowindow.py

示例13: init_ui

# 需要导入模块: from PyQt5.QtWidgets import QVBoxLayout [as 别名]
# 或者: from PyQt5.QtWidgets.QVBoxLayout import setAlignment [as 别名]
    def init_ui(self, title):
        self.setWindowTitle(title)

        btn_close = create_button('Close', self.close)

        buttons = QHBoxLayout()

        buttons.addWidget(btn_close)
        buttons.setAlignment(Qt.AlignBottom)

        body = QVBoxLayout()
        body.setAlignment(Qt.AlignTop)

        header = QLabel(
            'If you choose an automatic (scheduled) mode '
            'the "ctrl+n" shortcut and menu checkbox for '
            'quick toggle will switch between the manual '
            'and automatic mode (when used for the first '
            'time).'
        )
        header.setWordWrap(True)

        mode_switches = QHBoxLayout()
        mode_switches.addWidget(QLabel('Mode:'))
        self.manual = create_button('Manual', self.on_set_manual)
        self.auto = create_button('Automatic', self.on_set_automatic)
        mode_switches.addWidget(self.manual)
        mode_switches.addWidget(self.auto)

        time_controls = QHBoxLayout()
        time_controls.setAlignment(Qt.AlignTop)

        start_at = TimeEdit(self, self.settings['start_at'], 'From', self.start_update)
        end_at = TimeEdit(self, self.settings['end_at'], 'To', self.end_update)
        time_controls.addWidget(start_at)
        time_controls.addWidget(end_at)

        self.time_controls = time_controls

        self.set_mode(self.settings['mode'], False)

        body.addWidget(header)
        body.addStretch(1)
        body.addLayout(mode_switches)
        body.addLayout(time_controls)
        body.addStretch(1)
        body.addLayout(buttons)
        self.setLayout(body)

        self.setGeometry(300, 300, 470, 255)
        self.show()
开发者ID:krassowski,项目名称:Anki-Night-Mode,代码行数:53,代码来源:mode.py

示例14: __init__

# 需要导入模块: from PyQt5.QtWidgets import QVBoxLayout [as 别名]
# 或者: from PyQt5.QtWidgets.QVBoxLayout import setAlignment [as 别名]
 def __init__(self, listing, student_tabs):
     super().__init__(student_tabs.tabs)
     self.listing = listing
     layout = QVBoxLayout()
     self.setLayout(layout)
     self.table = QTableView()
     self.table.setMinimumWidth(500)
     self.table.setMinimumHeight(300)
     layout.addWidget(self.table)
     self.model = StudentsTableModel(listing, GroupWidget._COLUMN_MAP, self)
     self.table.setModel(self.model)
     self.table.setSelectionBehavior(QTableView.SelectRows)
     layout.setAlignment(self.table, Qt.AlignHCenter)
     self._resize_table()
开发者ID:jfisteus,项目名称:eyegrade,代码行数:16,代码来源:students.py

示例15: EdgeInfo

# 需要导入模块: from PyQt5.QtWidgets import QVBoxLayout [as 别名]
# 或者: from PyQt5.QtWidgets.QVBoxLayout import setAlignment [as 别名]
class EdgeInfo(AbstractInfo):
    """
    This class implements the information box for generic edges.
    """
    def __init__(self, mainwindow, parent=None):
        """
        Initialize the generic edge information box.
        :type mainwindow: MainWindow
        :type parent: QWidget
        """
        super().__init__(mainwindow, parent)

        self.h1 = Header('General', self)

        self.typeKey = Key('Type', self)
        self.typeField = Str(self)
        self.typeField.setReadOnly(True)

        self.sourceKey = Key('Source', self)
        self.sourceField = Str(self)
        self.sourceField.setReadOnly(True)

        self.targetKey = Key('Target', self)
        self.targetField = Str(self)
        self.targetField.setReadOnly(True)

        self.generalLayout = QFormLayout()
        self.generalLayout.setSpacing(0)
        self.generalLayout.addRow(self.typeKey, self.typeField)
        self.generalLayout.addRow(self.sourceKey, self.sourceField)
        self.generalLayout.addRow(self.targetKey, self.targetField)

        self.mainLayout = QVBoxLayout(self)
        self.mainLayout.setAlignment(Qt.AlignTop)
        self.mainLayout.setContentsMargins(0, 0, 0, 0)
        self.mainLayout.setSpacing(0)
        self.mainLayout.addWidget(self.h1)
        self.mainLayout.addLayout(self.generalLayout)

    def updateData(self, edge):
        """
        Fetch new information and fill the widget with data.
        :type edge: AbstractEdge
        """
        self.sourceField.setValue(edge.source.id)
        self.targetField.setValue(edge.target.id)
        self.typeField.setValue(edge.shortname.capitalize())
        self.typeField.home(True)
        self.typeField.deselect()
开发者ID:gitter-badger,项目名称:eddy,代码行数:51,代码来源:info.py


注:本文中的PyQt5.QtWidgets.QVBoxLayout.setAlignment方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。